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 ))