From a6846dd161b547ea75444047d5106bb8ce1aba04 Mon Sep 17 00:00:00 2001 From: Luciano Lo Giudice Date: Mon, 2 May 2022 14:37:54 -0300 Subject: [PATCH] Add a few retries to avoid race conditions --- .../charm_tests/ceph/dashboard/tests.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/ceph/dashboard/tests.py b/zaza/openstack/charm_tests/ceph/dashboard/tests.py index 3e1ddc4..112eaa1 100644 --- a/zaza/openstack/charm_tests/ceph/dashboard/tests.py +++ b/zaza/openstack/charm_tests/ceph/dashboard/tests.py @@ -151,6 +151,8 @@ class CephDashboardTest(test_utils.BaseCharmTest): headers=headers, verify=verify) + @tenacity.retry(wait=tenacity.wait_fixed(2), reraise=True, + stop=tenacity.stop_after_attempt(90)) def get_master_dashboard_url(self): """Get the url of the dashboard servicing requests. @@ -163,7 +165,10 @@ class CephDashboardTest(test_utils.BaseCharmTest): output = zaza.model.run_on_leader( 'ceph-mon', 'ceph mgr services')['Stdout'] - return json.loads(output)['dashboard'] + url = json.loads(output).get('dashboard') + if url is None: + raise tenacity.RetryError(None) + return url def test_dashboard_units(self): """Check dashboard units are configured correctly.""" @@ -266,6 +271,16 @@ class CephDashboardTest(test_utils.BaseCharmTest): 'ceph config-key exists {}'.format(key)) self.assertEqual(check_out['Code'], '0') + @tenacity.retry(wait=tenacity.wait_fixed(2), reraise=True, + stop=tenacity.stop_after_attempt(20)) + def wait_for_saml_dashboard(self): + output = zaza.model.run_on_leader( + 'ceph-mon', + 'ceph dashboard sso status')['Stdout'] + if 'enabled' in output: + return + raise tenacity.RetryError(None) + def test_saml(self): """Check that the dashboard is accessible with SAML enabled.""" get_os_release = openstack_utils.get_os_release