Add start actionplan test
Change-Id: Ib024112957747185ab4efc780b3a9cc75a0d7aaf
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user