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

This commit is contained in:
Luciano Lo Giudice
2024-08-14 13:22:59 -03:00
parent 3b8450f6d3
commit fcdcc81c64

View File

@@ -216,7 +216,7 @@ class CephRBDMirrorBase(test_utils.BaseCharmTest):
if result.status == "failed":
logging.error("status action failed: %s", result.message)
return
return json.loads(result.results['output'])
return json.loads(result.get('Stdout'))
def get_pools(self):
"""Retrieve list of pools from both sites.
@@ -503,11 +503,11 @@ class CephRBDMirrorControlledFailoverTest(CephRBDMirrorBase):
'pools': ','.join(primary_site_pools)
})
logging.info(result.results)
self.assertEqual(int(result.results['Code']), 0)
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
@@ -537,11 +537,11 @@ class CephRBDMirrorControlledFailoverTest(CephRBDMirrorBase):
'pools': ','.join(secondary_site_pools)
})
logging.info(result.results)
self.assertEqual(int(result.results['Code']), 0)
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
@@ -711,7 +711,7 @@ class CephRBDMirrorControlledFailoverTest(CephRBDMirrorBase):
'i-really-mean-it': True,
})
logging.info(result.results)
self.assertEqual(int(result.results['Code']), 0)
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
@@ -801,7 +801,7 @@ class CephRBDMirrorDisasterFailoverTest(CephRBDMirrorBase):
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.
@@ -816,7 +816,7 @@ class CephRBDMirrorDisasterFailoverTest(CephRBDMirrorBase):
'force': True,
'pools': ','.join(site_b_pools),
})
self.assertEqual(int(result.results['Code']), 0)
self.assertEqual(int(result.get('Code')), 0)
# Validate successful Juju action execution
self.assertEqual(result.status, 'completed')