diff --git a/watcher_tempest_plugin/tests/api/admin/base.py b/watcher_tempest_plugin/tests/api/admin/base.py index dd1ae30..9b17b1c 100644 --- a/watcher_tempest_plugin/tests/api/admin/base.py +++ b/watcher_tempest_plugin/tests/api/admin/base.py @@ -257,6 +257,24 @@ class BaseInfraOptimTest(test.BaseTestCase): return action_plans['action_plans'][0] + @classmethod + def start_action_plan(cls, action_plan_uuid): + """Starts an action plan having the specified UUID + + :param action_plan_uuid: The unique identifier of the action plan. + :return: the HTTP response + """ + resp, _ = cls.client.start_action_plan(action_plan_uuid) + + test_utils.call_until_true( + func=functools.partial( + cls.is_action_plan_idle, action_plan_uuid), + duration=30, + sleep_for=.5 + ) + + return resp + @classmethod def delete_action_plan(cls, action_plan_uuid): """Deletes an action plan having the specified UUID diff --git a/watcher_tempest_plugin/tests/api/admin/test_action_plan.py b/watcher_tempest_plugin/tests/api/admin/test_action_plan.py index 442ac42..14926f1 100644 --- a/watcher_tempest_plugin/tests/api/admin/test_action_plan.py +++ b/watcher_tempest_plugin/tests/api/admin/test_action_plan.py @@ -48,6 +48,29 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest): self.assertEqual(audit['uuid'], action_plan['audit_uuid']) self.assertEqual('RECOMMENDED', action_plan['state']) + @decorators.attr(type='smoke') + def test_execute_action_plan(self): + _, goal = self.client.show_goal("dummy") + _, audit_template = self.create_audit_template(goal['uuid']) + _, audit = self.create_audit(audit_template['uuid']) + + self.assertTrue(test_utils.call_until_true( + func=functools.partial(self.has_audit_finished, audit['uuid']), + duration=30, + sleep_for=.5 + )) + _, action_plans = self.client.list_action_plans( + audit_uuid=audit['uuid']) + action_plan = action_plans['action_plans'][0] + + _, action_plan = self.client.show_action_plan(action_plan['uuid']) + self.assertEqual('RECOMMENDED', action_plan['state']) + + self.start_action_plan(action_plan['uuid']) + + _, action_plan = self.client.show_action_plan(action_plan['uuid']) + self.assertEqual('SUCCEEDED', action_plan['state']) + @decorators.attr(type='smoke') def test_delete_action_plan(self): _, goal = self.client.show_goal("dummy")