Allow passing service_codes to wait_for_all_endpoints

Some projects will return specific failed code when up because of
templating in URL. In some other case, due to the nature of the test,
the service will never go up but be present in keystone. Allow the
caller to override which service returns a specific code.

Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
This commit is contained in:
Guillaume Boutry
2025-01-27 09:27:50 +01:00
parent af5bea7072
commit 7a8432451e
+7 -4
View File
@@ -170,22 +170,25 @@ def add_tempest_roles():
_add_additional_roles(TEMPEST_ROLES)
def wait_for_all_endpoints(interface='public'):
def wait_for_all_endpoints(interface='public', service_codes=None):
"""Check all endpoints are returning an acceptable return code.
:param interface: Endpoint type to check. public, admin or internal
:type interface: str
:param service_codes: Dict of service names and acceptable return codes
:type service_codes: Optional[dict]
:raises: AssertionError
"""
if service_codes is None:
service_codes = {}
keystone_client = openstack_utils.get_keystone_overcloud_session_client()
for service in keystone_client.services.list():
for ep in keystone_client.endpoints.list(service=service,
interface=interface):
openstack_utils.wait_for_url(
ep.url,
# Heat cloudformation and orchestration return 400 and 401
[
requests.codes.ok,
requests.codes.multiple_choices,
requests.codes.bad_request,
requests.codes.unauthorized])
requests.codes.unauthorized,
] + service_codes.get(service.name, []))