Skip to content

Commit

Permalink
Use a different waiting strategy for ceph-fs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lmlg committed Apr 25, 2024
1 parent 1ecd7cc commit f8136a6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions zaza/openstack/charm_tests/ceph/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,7 @@ def _get_all_keys(self, unit, entity_filter):
ret.add((data[ix - 1], data[ix + 1]))
return ret

def _check_key_rotation(self, entity, unit, states=None):
def _check_key_rotation(self, entity, unit, wait_for_unit=None):
def entity_filter(name):
return name.startswith(entity)

Expand All @@ -1781,7 +1781,11 @@ def entity_filter(name):
action_params={'entity': entity}
)
zaza_utils.assertActionRanOK(action_obj)
zaza_model.wait_for_application_states(states=states)
if wait_for_unit is None:
# Wait for all applications
zaza_model.wait_for_application_states()
else:
zaza_model.wait_for_unit_idle(wait_for_unit)
new_keys = self._get_all_keys(unit, entity_filter)
self.assertNotEqual(old_keys, new_keys)
diff = new_keys - old_keys
Expand Down Expand Up @@ -1817,14 +1821,11 @@ def test_key_rotate(self):
zaza_model.get_application('ceph-fs')
fs_svc = self._get_all_keys(unit, lambda x: x.startswith('mds.'))
if fs_svc is not None:
ubuntu_states = {
'ubuntu': {
'workload-status': 'active',
'workload-status-message': ''
}
}
# Only wait for ceph-fs, as this model includes 'ubuntu'
# units, and those don't play nice with zaza (they don't
# set the workload-status-message correctly).
self._check_key_rotation(next(iter(fs_svc))[0], unit,
ubuntu_states)
'ceph-fs/0')
else:
logging.info('ceph-fs units present, but no MDS service')
except KeyError:
Expand Down

0 comments on commit f8136a6

Please sign in to comment.