From 5d05eb70ccc3d71613b5326a6a28407175498d8d Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Thu, 14 May 2020 19:37:45 +0100 Subject: [PATCH] Ensure model starts executing before the wait There was a race before a block_until_all_units_idle() where it could blast through the check before it started removing the relation. This ensures that it waits until something happens and then waits for it to finish. --- zaza/openstack/charm_tests/ceph/mon/tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zaza/openstack/charm_tests/ceph/mon/tests.py b/zaza/openstack/charm_tests/ceph/mon/tests.py index dd6d7aa..63c4033 100644 --- a/zaza/openstack/charm_tests/ceph/mon/tests.py +++ b/zaza/openstack/charm_tests/ceph/mon/tests.py @@ -86,6 +86,7 @@ class CinderCephMonTest(test_utils.OpenStackBaseTest): logging.info("Removing ceph-mon:client <-> cinder-ceph:ceph relation") zaza.model.remove_relation( "ceph-mon", "ceph-mon:client", "cinder-ceph:ceph") + zaza.model.wait_for_agent_status() logging.info("Wait till model is idle ...") zaza.model.block_until_all_units_idle() @@ -104,6 +105,7 @@ class CinderCephMonTest(test_utils.OpenStackBaseTest): logging.info("Restoring ceph-mon:client <-> cinder-ceph:ceph relation") zaza.model.add_relation( "ceph-mon", "ceph-mon:client", "cinder-ceph:ceph") + zaza.model.wait_for_agent_status() logging.info("Wait till model is idle ...") zaza.model.block_until_all_units_idle() logging.info("... Done.")