From 48234651757e5803edabcc843c6a42741959311d Mon Sep 17 00:00:00 2001 From: Liam Young Date: Tue, 24 Oct 2023 11:59:35 +0000 Subject: [PATCH] Retry on 404s for keystone ldap --- .../charm_tests/keystone/tests_ldap_k8s.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/keystone/tests_ldap_k8s.py b/zaza/openstack/charm_tests/keystone/tests_ldap_k8s.py index 771f5cd..8cf1d81 100644 --- a/zaza/openstack/charm_tests/keystone/tests_ldap_k8s.py +++ b/zaza/openstack/charm_tests/keystone/tests_ldap_k8s.py @@ -14,8 +14,9 @@ """Keystone LDAP tests on k8s.""" import json - +import tenacity import contextlib +import keystoneauth1.exceptions.http.NotFound as http_NotFound import zaza.openstack.charm_tests.keystone.tests as ks_tests import zaza.openstack.charm_tests.tempest.tests as tempest_tests import zaza.charm_lifecycle.utils as lifecycle_utils @@ -101,6 +102,18 @@ class LdapExplicitCharmConfigTestsK8S(ks_tests.LdapExplicitCharmConfigTests): "ldap-config-flags": config_flags, "domain-name": "userdomain"} + @tenacity.retry(wait=tenacity.wait_exponential(multiplier=2, max=60), + reraise=True, stop=tenacity.stop_after_attempt(5), + retry=tenacity.retry_if_exception_type(http_NotFound)) + def _find_keystone_v3_group(self, group, domain): + super()._find_keystone_v3_group(group, domain) + + @tenacity.retry(wait=tenacity.wait_exponential(multiplier=2, max=60), + reraise=True, stop=tenacity.stop_after_attempt(5), + retry=tenacity.retry_if_exception_type(http_NotFound)) + def _find_keystone_v3_user(username, domain, group=None): + super()._find_keystone_v3_user(username, domain, group=group) + class KeystoneTempestTestK8S(tempest_tests.TempestTestScaleK8SBase): """Test keystone k8s scale out and scale back."""