From b087c0c2bda4fa19337b6d4ea2bedd445799d69d Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Mon, 4 Sep 2023 15:49:31 -0300 Subject: [PATCH] Retry check to avoid live migration unstability. --- zaza/openstack/charm_tests/watcher/tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/zaza/openstack/charm_tests/watcher/tests.py b/zaza/openstack/charm_tests/watcher/tests.py index 209eb4b..b43c11b 100644 --- a/zaza/openstack/charm_tests/watcher/tests.py +++ b/zaza/openstack/charm_tests/watcher/tests.py @@ -14,6 +14,7 @@ """Encapsulate Cinder testing.""" import logging +import tenacity import zaza.openstack.charm_tests.test_utils as test_utils import zaza.openstack.utilities.openstack as openstack_utils @@ -43,6 +44,16 @@ class WatcherTests(test_utils.OpenStackBaseTest): def test_server_consolidation(self): """Test server consolidation policy.""" + for i, attempt in enumerate(tenacity.Retrying( + wait=tenacity.wait_fixed(2), + retry=tenacity.retry_if_exception_type(AssertionError), + reraise=True, + stop=tenacity.stop_after_attempt(4))): + with attempt: + logger.info('Attempt number %d', i + 1) + self._check_server_consolidation() + + def _check_server_consolidation(self): try: at = self.watcher_client.audit_template.get( self.AUDIT_TEMPLATE_NAME