From 10756f7a663d611f6dae0f69d57fe07c97ff9243 Mon Sep 17 00:00:00 2001 From: Linda Guo Date: Fri, 11 Dec 2020 10:13:41 +1100 Subject: [PATCH] Add NovaComputeActionTest test class for virsh_audit action --- zaza/openstack/charm_tests/nova/tests.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/zaza/openstack/charm_tests/nova/tests.py b/zaza/openstack/charm_tests/nova/tests.py index 79e0e70..b8e7552 100644 --- a/zaza/openstack/charm_tests/nova/tests.py +++ b/zaza/openstack/charm_tests/nova/tests.py @@ -155,6 +155,29 @@ class NovaCompute(test_utils.OpenStackBaseTest): self.assertFalse(int(run['Code']) == 0) +class NovaComputeActionTest(test_utils.OpenStackBaseTest): + """Run nova-compute specific tests. + + Add this test class for new nova-compute action + to avoid breaking older version + """ + + def test_virsh_audit_action(self): + """Test virsh-audit action.""" + for unit in zaza.model.get_units('nova-compute', + model_name=self.model_name): + logging.info('Running `virsh-audit` action' + ' on unit {}'.format(unit.entity_id)) + action = zaza.model.run_action( + unit.entity_id, + 'virsh-audit', + model_name=self.model_name, + action_params={}) + if "failed" in action.data["status"]: + raise Exception( + "The action failed: {}".format(action.data["message"])) + + class NovaCloudController(test_utils.OpenStackBaseTest): """Run nova-cloud-controller specific tests."""