Make Ceph tests more generic (#1034)
This commit is contained in:
committed by
GitHub
parent
2c61ed752b
commit
e4a9aadf05
@@ -116,33 +116,6 @@ class CephLowLevelTest(test_utils.BaseCharmTest):
|
||||
self.assertEqual(pool['pg_autoscale_mode'], 'on')
|
||||
|
||||
|
||||
class CephRelationTest(test_utils.BaseCharmTest):
|
||||
"""Ceph's relations test class."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Run the ceph's relations class setup."""
|
||||
super(CephRelationTest, cls).setUpClass()
|
||||
|
||||
def test_ceph_osd_ceph_relation_address(self):
|
||||
"""Verify the ceph-osd to ceph relation data."""
|
||||
logging.info('Checking ceph-osd:ceph-mon relation data...')
|
||||
unit_name = 'ceph-osd/0'
|
||||
remote_unit_name = 'ceph-mon/0'
|
||||
relation_name = 'osd'
|
||||
remote_unit = zaza_model.get_unit_from_name(remote_unit_name)
|
||||
remote_ip = zaza_model.get_unit_public_address(remote_unit)
|
||||
relation = juju_utils.get_relation_from_unit(
|
||||
unit_name,
|
||||
remote_unit_name,
|
||||
relation_name
|
||||
)
|
||||
# Get private-address in relation
|
||||
rel_private_ip = relation.get('private-address')
|
||||
# The private address in relation should match ceph-mon/0 address
|
||||
self.assertEqual(rel_private_ip, remote_ip)
|
||||
|
||||
|
||||
class CephTest(test_utils.BaseCharmTest):
|
||||
"""Ceph common functional tests."""
|
||||
|
||||
@@ -418,6 +391,12 @@ class CephTest(test_utils.BaseCharmTest):
|
||||
logging.info('Checking pause and resume actions...')
|
||||
self.pause_resume(['ceph-osd'])
|
||||
|
||||
def get_device_for_blacklist(self, unit):
|
||||
"""Return a device to be used by the blacklist tests."""
|
||||
cmd = "mount | grep 'on / ' | awk '{print $1}'"
|
||||
obj = zaza_model.run_on_unit(unit, cmd)
|
||||
return obj.get('Stdout').strip()
|
||||
|
||||
def test_blacklist(self):
|
||||
"""Check the blacklist action.
|
||||
|
||||
@@ -457,10 +436,15 @@ class CephTest(test_utils.BaseCharmTest):
|
||||
)
|
||||
|
||||
# Attempt to add device with existent path should succeed
|
||||
device = self.get_device_for_blacklist(unit_name)
|
||||
if not device:
|
||||
raise unittest.SkipTest(
|
||||
"Skipping test because no device was found")
|
||||
|
||||
action_obj = zaza_model.run_action(
|
||||
unit_name=unit_name,
|
||||
action_name='blacklist-add-disk',
|
||||
action_params={'osd-devices': '/dev/vda'}
|
||||
action_params={'osd-devices': device}
|
||||
)
|
||||
self.assertEqual('completed', action_obj.status)
|
||||
zaza_model.block_until_unit_wl_status(
|
||||
@@ -472,7 +456,7 @@ class CephTest(test_utils.BaseCharmTest):
|
||||
action_obj = zaza_model.run_action(
|
||||
unit_name=unit_name,
|
||||
action_name='blacklist-remove-disk',
|
||||
action_params={'osd-devices': '/dev/vda'}
|
||||
action_params={'osd-devices': device}
|
||||
)
|
||||
self.assertEqual('completed', action_obj.status)
|
||||
zaza_model.block_until_unit_wl_status(
|
||||
|
||||
Reference in New Issue
Block a user