From 850db0c5e31f0ae05ce80bd0d3a217971f33fcee Mon Sep 17 00:00:00 2001 From: Guillaume Boutry Date: Thu, 28 Sep 2023 13:01:43 +0200 Subject: [PATCH] Add waiting for endpoints between units scaling Traefik might take some time to update its configuration, and switch multiple times between active and maintenance for the duration. Waiting only for tests is not enough. This change introduce a wait for endpoints to be ready. Moreover, at glance call to setup the image might fail because of this very reason, add a retry on render_tempest_config_keystone_v3. --- zaza/openstack/charm_tests/tempest/tests.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 6e21a2796..ed6ddb3cc 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -17,7 +17,6 @@ import logging import os import subprocess -import tenacity import zaza import zaza.charm_lifecycle.utils @@ -25,6 +24,7 @@ import zaza.openstack.charm_tests.tempest.utils as tempest_utils import zaza.charm_lifecycle.utils as lifecycle_utils import tempfile +import tenacity class TempestTestBase(): @@ -183,7 +183,11 @@ def run(self): :returns: Status of tempest run :rtype: bool """ - tempest_utils.render_tempest_config_keystone_v3(minimal=True) + render_tempest_config_keystone_v3 = tenacity.retry( + wait=tenacity.wait_fixed(10), stop=tenacity.stop_after_attempt(3) + )(tempest_utils.render_tempest_config_keystone_v3) + zaza.openstack.charm_tests.keystone.setup.wait_for_all_endpoints() + render_tempest_config_keystone_v3(minimal=True) if not super().run(): return False @@ -193,7 +197,8 @@ def run(self): zaza.model.block_until_all_units_idle() logging.info("Wait for status ready ...") zaza.model.wait_for_application_states(states=self.expected_statuses) - tempest_utils.render_tempest_config_keystone_v3(minimal=True) + zaza.openstack.charm_tests.keystone.setup.wait_for_all_endpoints() + render_tempest_config_keystone_v3(minimal=True) if not super().run(): return False @@ -206,7 +211,8 @@ def run(self): zaza.model.block_until_all_units_idle() logging.info("Wait for status ready ...") zaza.model.wait_for_application_states(states=self.expected_statuses) - tempest_utils.render_tempest_config_keystone_v3(minimal=True) + zaza.openstack.charm_tests.keystone.setup.wait_for_all_endpoints() + render_tempest_config_keystone_v3(minimal=True) return super().run()