def test_recover_disabled(self): cluster = MesosCluster('mesos-cluster-a.me', enabled=False) mock_task = mock.MagicMock() mock_task.get_mesos_id.return_value = 'this_task' cluster.recover(mock_task) assert 'this_task' not in cluster.tasks mock_task.exited.assert_called_once_with(None)
def test_recover(self): cluster = MesosCluster('mesos-cluster-a.me') mock_task = mock.MagicMock() mock_task.get_mesos_id.return_value = 'this_task' cluster.recover(mock_task) assert 'this_task' in cluster.tasks assert cluster.tasks['this_task'] == mock_task cluster.runner.reconcile.assert_called_once_with( mock_task.get_config.return_value, ) assert mock_task.started.call_count == 1