Add start actionplan test

Change-Id: Ib024112957747185ab4efc780b3a9cc75a0d7aaf
This commit is contained in:
licanwei
2018-09-04 10:52:29 +08:00
parent c3c13ecda6
commit 3acd59f8c6
2 changed files with 41 additions and 0 deletions

View File

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

View File

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