From fb2dde068673bfeef4a6dd23ba0396505c75560d Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Mon, 19 Apr 2021 11:56:16 -0400 Subject: [PATCH] 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. Change-Id: Ib3e03b43e0bf5b484af3f42c2da6cdcbb9e4abd9 --- cinder/tests/unit/test_coordination.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cinder/tests/unit/test_coordination.py b/cinder/tests/unit/test_coordination.py index b68928967f1..5b144eea228 100644 --- a/cinder/tests/unit/test_coordination.py +++ b/cinder/tests/unit/test_coordination.py @@ -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)