From 982410dd3e0487417015aeff1440c6c513313782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Fran=C3=A7oise?= Date: Fri, 22 Jan 2016 18:27:05 +0100 Subject: [PATCH] Fixed tempest test bug has_audit_succeeded was not implemented so I added it back. Change-Id: Ic567ff56ea6d513c32fbe7ad08cca96b5dfb15e8 Closes-Bug: #1537144 --- watcher_tempest_plugin/tests/scenario/base.py | 8 ++++++++ .../tests/scenario/test_execute_dummy_optim.py | 6 ++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/watcher_tempest_plugin/tests/scenario/base.py b/watcher_tempest_plugin/tests/scenario/base.py index 59f4dd403..89c573990 100644 --- a/watcher_tempest_plugin/tests/scenario/base.py +++ b/watcher_tempest_plugin/tests/scenario/base.py @@ -142,6 +142,10 @@ class BaseInfraOptimScenarioTest(manager.ScenarioTest): resp, _ = self.client.delete_audit(audit_uuid) return resp + def has_audit_succeeded(self, audit_uuid): + _, audit = self.client.show_audit(audit_uuid) + return audit.get('state') == 'SUCCEEDED' + # ### ACTION PLANS ### # def delete_action_plan(self, action_plan_uuid): @@ -152,3 +156,7 @@ class BaseInfraOptimScenarioTest(manager.ScenarioTest): """ resp, _ = self.client.delete_action_plan(action_plan_uuid) return resp + + def has_action_plan_finished(self, action_plan_uuid): + _, action_plan = self.client.show_action_plan(action_plan_uuid) + return action_plan.get('state') in ('FAILED', 'SUCCEEDED', 'CANCELLED') diff --git a/watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py b/watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py index 8d3dd319b..683bf0a2f 100644 --- a/watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py +++ b/watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py @@ -55,11 +55,9 @@ class TestExecuteDummyStrategy(base.BaseInfraOptimScenarioTest): patch=[{'path': '/state', 'op': 'replace', 'value': 'TRIGGERED'}] ) - def has_finished(action_plan_uuid): - return self.has_action_plan_finished(action_plan_uuid) - self.assertTrue(test.call_until_true( - func=functools.partial(has_finished, action_plan['uuid']), + func=functools.partial( + self.has_action_plan_finished, action_plan['uuid']), duration=30, sleep_for=.5 ))