Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new-style fields in action object for RBD tests #1255

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions zaza/openstack/charm_tests/ceph/rbd_mirror/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,19 +495,19 @@ def execute_failover_juju_actions(self,
# Run the 'demote' Juju action against the primary site pools.
logging.info('Demoting {} from model {}.'.format(
primary_site_app_name, primary_site_model))
result = zaza.model.run_action_on_leader(
result = zaza.model.run_on_leader(
primary_site_app_name,
'demote',
model_name=primary_site_model,
action_params={
'pools': ','.join(primary_site_pools)
})
logging.info(result.results)
self.assertEqual(int(result.results['Code']), 0)
logging.info(result)
self.assertEqual(int(result.get('Code')), 0)

# Validate that the demoted pools count matches the total primary site
# pools count.
n_pools_demoted = len(result.results['output'].split('\n'))
n_pools_demoted = len(result.get('Stdout').split('\n'))
self.assertEqual(len(primary_site_pools), n_pools_demoted)

# At this point, both primary and secondary sites are demoted. Validate
Expand All @@ -529,19 +529,19 @@ def execute_failover_juju_actions(self,
# Run the 'promote' Juju against the secondary site.
logging.info('Promoting {} from model {}.'.format(
secondary_site_app_name, secondary_site_model))
result = zaza.model.run_action_on_leader(
result = zaza.model.run_on_leader(
secondary_site_app_name,
'promote',
model_name=secondary_site_model,
action_params={
'pools': ','.join(secondary_site_pools)
})
logging.info(result.results)
self.assertEqual(int(result.results['Code']), 0)
logging.info(result)
self.assertEqual(int(result.get('Code')), 0)

# Validate that the promoted pools count matches the total secondary
# site pools count.
n_pools_promoted = len(result.results['output'].split('\n'))
n_pools_promoted = len(result.get('Stdout').split('\n'))
self.assertEqual(len(secondary_site_pools), n_pools_promoted)

# Validate that the Ceph images from the newly promoted site
Expand Down Expand Up @@ -702,16 +702,16 @@ def test_203_juju_resync(self):
site_b_app_name = self.application_name + self.site_b_app_suffix
logging.info('Re-syncing {} from model {}'.format(
site_b_app_name, self.site_b_model))
result = zaza.model.run_action_on_leader(
result = zaza.model.run_on_leader(
site_b_app_name,
'resync-pools',
model_name=self.site_b_model,
action_params={
'pools': ','.join(site_b_pools),
'i-really-mean-it': True,
})
logging.info(result.results)
self.assertEqual(int(result.results['Code']), 0)
logging.info(result)
self.assertEqual(int(result.get('Code')), 0)

# Validate that the Ceph images from site-b report 'up+replaying'
# (which is reported by secondary Ceph images). And check that images
Expand Down Expand Up @@ -794,14 +794,14 @@ def test_100_forced_juju_failover(self):
self.kill_primary_site()

# Try and promote the site-b to primary.
result = zaza.model.run_action_on_leader(
result = zaza.model.run_on_leader(
site_b_app_name,
'promote',
model_name=self.site_b_model,
action_params={
'pools': ','.join(site_b_pools),
})
self.assertEqual(int(result.results['Code']), 0)
self.assertEqual(int(result.get('Code')), 0)

# The action may not show up as 'failed' if there are no pools that
# needed to be promoted.
Expand All @@ -816,7 +816,6 @@ def test_100_forced_juju_failover(self):
'force': True,
'pools': ','.join(site_b_pools),
})
self.assertEqual(int(result.results['Code']), 0)

# Validate successful Juju action execution
self.assertEqual(result.status, 'completed')
Expand Down
Loading