Skip to content

Commit

Permalink
Merge pull request #1293 from gboutry/fix/wait-all-endpoints
Browse files Browse the repository at this point in the history
Allow passing service_codes to wait_for_all_endpoints
  • Loading branch information
javacruft authored Jan 27, 2025
2 parents af5bea7 + 7a84324 commit 506c8b1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions zaza/openstack/charm_tests/keystone/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, []))

0 comments on commit 506c8b1

Please sign in to comment.