Tests: Add coverage for coordinator start/stop
These tests test the logic for start/stop skipping
their actions based on the value of self.started.
A new test for this took about 2.5s to run, so I've
opted to cover this within existing tests.
@@ -60,6 +60,9 @@ class CoordinatorTestCase(test.TestCase):
self.assertTrue(get_coordinator.called)
self.assertTrue(crd.start.called)
+ agent.start()
+ crd.start.assert_called_once_with(start_heart=True)
+
def test_coordinator_stop(self, get_coordinator):
crd = get_coordinator.return_value
@@ -70,6 +73,9 @@ class CoordinatorTestCase(test.TestCase):
self.assertTrue(crd.stop.called)
self.assertIsNone(agent.coordinator)
+ agent.stop()
+ crd.stop.assert_called_once_with()
+
def test_coordinator_lock(self, get_coordinator):
crd = get_coordinator.return_value
crd.get_lock.side_effect = lambda n: MockToozLock(n)
