Exemple #1
0
 def test_stop(self):
     cluster = MesosCluster('mesos-cluster-a.me')
     mock_task = mock.MagicMock()
     cluster.tasks = {'task_id': mock_task}
     cluster.stop()
     assert_equal(cluster.runner.stop.call_count, 1)
     assert_equal(cluster.deferred.cancel.call_count, 1)
     mock_task.exited.assert_called_once_with(None)
     assert_equal(len(cluster.tasks), 0)
Exemple #2
0
 def test_stop_default(self):
     # When stopping, tasks should not exit. They will be recovered
     cluster = MesosCluster('mesos-cluster-a.me')
     mock_task = mock.MagicMock()
     cluster.tasks = {'task_id': mock_task}
     cluster.stop()
     assert cluster.runner.stop.call_count == 1
     assert cluster.deferred is None
     assert mock_task.exited.call_count == 0
     assert len(cluster.tasks) == 1
Exemple #3
0
 def test_stop_default(self):
     # When stopping, tasks should not exit. They will be recovered
     cluster = MesosCluster('mesos-cluster-a.me')
     mock_task = mock.MagicMock()
     cluster.tasks = {'task_id': mock_task}
     cluster.stop()
     assert cluster.runner.stop.call_count == 1
     assert cluster.deferred is None
     assert mock_task.exited.call_count == 0
     assert len(cluster.tasks) == 1
Exemple #4
0
 def test_stop_disabled(self):
     # Shouldn't raise an error
     cluster = MesosCluster('mesos-cluster-a.me', enabled=False)
     cluster.stop()
Exemple #5
0
 def test_stop_disabled(self):
     # Shouldn't raise an error
     cluster = MesosCluster('mesos-cluster-a.me', enabled=False)
     cluster.stop()