Skip to content

Commit

Permalink
Retry ceph-dashboard ssl verification test
Browse files Browse the repository at this point in the history
Avoid a race in configuring ssl on endpoints and services
  • Loading branch information
sabaini committed Sep 26, 2023
1 parent ea36acd commit ddfc610
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions zaza/openstack/charm_tests/ceph/dashboard/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,19 +331,25 @@ def _get_wait_for_dashboard_assert_state(

def verify_ssl_config(self, ca_file):
"""Check if request validates the configured SSL cert."""
rcs = collections.defaultdict(list)
units = zaza.model.get_units('ceph-mon')
for unit in units:
req = self._run_request_get(
'https://{}:8443'.format(
zaza.model.get_unit_public_address(unit)),
verify=ca_file,
allow_redirects=False)
rcs[req.status_code].append(
zaza.model.get_unit_public_address(unit)
)
self.assertEqual(len(rcs[requests.codes.ok]), 1)
self.assertEqual(len(rcs[requests.codes.see_other]), len(units) - 1)

for attempt in tenacity.Retrying(
wait=tenacity.wait_exponential(max=60),
reraise=True, stop=tenacity.stop_after_attempt(10)
):
with attempt:
rcs = collections.defaultdict(list)
for unit in units:
req = self._run_request_get(
'https://{}:8443'.format(
zaza.model.get_unit_public_address(unit)),
verify=ca_file,
allow_redirects=False)
rcs[req.status_code].append(
zaza.model.get_unit_public_address(unit)
)
self.assertEqual(len(rcs[requests.codes.ok]), 1)
self.assertEqual(len(rcs[requests.codes.see_other]), len(units) - 1)

def _get_dashboard_hostnames_sans(self):
"""Get a generator for Dashboard unit public addresses."""
Expand Down

0 comments on commit ddfc610

Please sign in to comment.