From 113eb62de3c24088f8dd0ab2679843beb96542db Mon Sep 17 00:00:00 2001 From: Liam Young Date: Tue, 18 Sep 2018 09:01:15 +0000 Subject: [PATCH] Add pause/resume actions to manilla Implement the pause and resume actions in the charm. Depends-On: https://review.openstack.org/#/c/603315/ Depends-On: https://review.openstack.org/#/c/603312/ Change-Id: I63d8ac5fd094ea6eadfb5d4583835e0e047f5370 --- src/tests/basic_deployment.py | 50 ++++++++++++++--------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/src/tests/basic_deployment.py b/src/tests/basic_deployment.py index 20d7209..a0ce535 100644 --- a/src/tests/basic_deployment.py +++ b/src/tests/basic_deployment.py @@ -111,20 +111,20 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment): self.keystone_sentry, openstack_release=self._get_openstack_release()) - def test_100_services(self): - """Verify the expected services are running on the corresponding - service units.""" - u.log.debug('Checking system services on units...') - - manila_svcs = [ + self.manila_svcs = [ 'manila-api', 'manila-scheduler', 'manila-share', 'manila-data', ] + def test_100_services(self): + """Verify the expected services are running on the corresponding + service units.""" + u.log.debug('Checking system services on units...') + service_names = { - self.manila_sentry: manila_svcs, + self.manila_sentry: self.manila_svcs, } ret = u.validate_services_by_name(service_names) @@ -493,30 +493,20 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment): self.d.configure(juju_service, set_default) u.log.debug('OK') - def _test_910_pause_and_resume(self): + def _assert_services(self, should_run): + services = self.manila_svcs + u.get_unit_process_ids( + {self.manila_sentry: services}, + expect_success=should_run) + + def test_910_pause_and_resume(self): """The services can be paused and resumed. """ - # test disabled as feature is not implemented yet - kept for future - # usage. - return - u.log.debug('Checking pause and resume actions...') - unit_name = "manila/0" - juju_service = 'manila' - unit = self.d.sentry[juju_service][0] - - assert u.status_get(unit)[0] == "active" - - action_id = u.run_action(unit_name, "pause") + self._assert_services(should_run=True) + action_id = u.run_action(self.manila_sentry, "pause") assert u.wait_on_action(action_id), "Pause action failed." - assert u.status_get(unit)[0] == "maintenance" - # trigger config-changed to ensure that services are still stopped - u.log.debug("Making config change on manila ...") - self.d.configure(juju_service, {'debug': 'True'}) - assert u.status_get(unit)[0] == "maintenance" - self.d.configure(juju_service, {'debug': 'False'}) - assert u.status_get(unit)[0] == "maintenance" + self._assert_services(should_run=False) - action_id = u.run_action(unit_name, "resume") - assert u.wait_on_action(action_id), "Resume action failed." - assert u.status_get(unit)[0] == "active" - u.log.debug('OK') + action_id = u.run_action(self.manila_sentry, "resume") + assert u.wait_on_action(action_id), "Resume action failed" + self._assert_services(should_run=True)