From 5da70ae0fd621521948750fd7224936e7bf701fb Mon Sep 17 00:00:00 2001 From: Luciano Lo Giudice Date: Tue, 9 Aug 2022 09:57:18 -0300 Subject: [PATCH] Move tests that aren't in stable to a different class (#849) In order to correctly test the upgrade from stable, we have to move the tests that haven't landed yet to a different class so that the charm can select to run them only after performing the upgrade to the locally built charm. --- zaza/openstack/charm_tests/ceph/tests.py | 94 ++++++++++++------------ 1 file changed, 49 insertions(+), 45 deletions(-) diff --git a/zaza/openstack/charm_tests/ceph/tests.py b/zaza/openstack/charm_tests/ceph/tests.py index 4f526be..b147fd2 100644 --- a/zaza/openstack/charm_tests/ceph/tests.py +++ b/zaza/openstack/charm_tests/ceph/tests.py @@ -624,51 +624,6 @@ class CephTest(test_utils.OpenStackBaseTest): action_params={'osd-ids': osd_id, 'purge': True} ) - def test_ceph_auth(self): - """Test creating and deleting user.""" - logging.info('Creating user and exported keyring...') - action_obj = zaza_model.run_action_on_leader( - 'ceph-mon', - 'get-or-create-user', - action_params={'username': 'sandbox', - 'mon-caps': 'allow r', - 'osd-caps': 'allow r'} - ) - logging.debug('Result of action: {}'.format(action_obj)) - create_results = json.loads(action_obj.data['results']['message']) - - logging.info('Getting existing user and exported keyring...') - action_obj = zaza_model.run_action_on_leader( - 'ceph-mon', - 'get-or-create-user', - action_params={'username': 'sandbox'} - ) - logging.debug('Result of action: {}'.format(action_obj)) - get_results = json.loads(action_obj.data['results']['message']) - - self.assertEqual(get_results, create_results) - - logging.info('Deleting existing user...') - action_obj = zaza_model.run_action_on_leader( - 'ceph-mon', - 'delete-user', - action_params={'username': 'sandbox'} - ) - logging.debug('Result of action: {}'.format(action_obj)) - delete_results = action_obj.data['results']['message'] - self.assertEqual(delete_results, "updated\n") - - logging.info('Deleting non-existing user...') - action_obj = zaza_model.run_action_on_leader( - 'ceph-mon', - 'delete-user', - action_params={'username': 'sandbox'} - ) - logging.debug('Result of action: {}'.format(action_obj)) - delete_results = action_obj.data['results']['message'] - self.assertEqual(delete_results, - "entity client.sandbox does not exist\n") - class CephRGWTest(test_utils.BaseCharmTest): """Ceph RADOS Gateway Daemons Test Class. @@ -1423,3 +1378,52 @@ class BlueStoreCompressionCharmOperation(test_utils.BaseCharmTest): 'configuration') self.test_config[ 'target_deploy_status'] = stored_target_deploy_status + + +class CephAuthTest(unittest.TestCase): + """Ceph auth tests (user creation and deletion).""" + + def test_ceph_auth(self): + """Test creating and deleting user.""" + logging.info('Creating user and exported keyring...') + action_obj = zaza_model.run_action_on_leader( + 'ceph-mon', + 'get-or-create-user', + action_params={'username': 'sandbox', + 'mon-caps': 'allow r', + 'osd-caps': 'allow r'} + ) + logging.debug('Result of action: {}'.format(action_obj)) + create_results = json.loads(action_obj.data['results']['message']) + + logging.info('Getting existing user and exported keyring...') + action_obj = zaza_model.run_action_on_leader( + 'ceph-mon', + 'get-or-create-user', + action_params={'username': 'sandbox'} + ) + logging.debug('Result of action: {}'.format(action_obj)) + get_results = json.loads(action_obj.data['results']['message']) + + self.assertEqual(get_results, create_results) + + logging.info('Deleting existing user...') + action_obj = zaza_model.run_action_on_leader( + 'ceph-mon', + 'delete-user', + action_params={'username': 'sandbox'} + ) + logging.debug('Result of action: {}'.format(action_obj)) + delete_results = action_obj.data['results']['message'] + self.assertEqual(delete_results, "updated\n") + + logging.info('Deleting non-existing user...') + action_obj = zaza_model.run_action_on_leader( + 'ceph-mon', + 'delete-user', + action_params={'username': 'sandbox'} + ) + logging.debug('Result of action: {}'.format(action_obj)) + delete_results = action_obj.data['results']['message'] + self.assertEqual(delete_results, + "entity client.sandbox does not exist\n")