Merge "Action Plan state - Changed STARTING to TRIGGERED"

This commit is contained in:
Jenkins 2016-01-22 16:52:03 +00:00 committed by Gerrit Code Review
commit 9e5a3708e1
5 changed files with 10 additions and 8 deletions

View File

@ -386,7 +386,8 @@ class ActionPlansController(rest.RestController):
if action_plan_to_update[field] != patch_val:
action_plan_to_update[field] = patch_val
if field == 'state' and patch_val == 'STARTING':
if (field == 'state'
and patch_val == objects.action_plan.State.TRIGGERED):
launch_action_plan = True
action_plan_to_update.save()

View File

@ -77,6 +77,7 @@ from watcher.objects import utils as obj_utils
class State(object):
RECOMMENDED = 'RECOMMENDED'
TRIGGERED = 'TRIGGERED'
ONGOING = 'ONGOING'
FAILED = 'FAILED'
SUCCEEDED = 'SUCCEEDED'

View File

@ -419,7 +419,7 @@ class TestPatch(api_base.FunctionalTest):
def test_replace_ok_state_starting(self):
with mock.patch.object(aapi.ApplierAPI,
'launch_action_plan') as applier_mock:
new_state = 'STARTING'
new_state = objects.action_plan.State.TRIGGERED
response = self.get_json(
'/action_plans/%s' % self.action_plan.uuid)
self.assertNotEqual(new_state, response['state'])

View File

@ -80,10 +80,10 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest):
_, action_plan = self.client.show_action_plan(action_plan['uuid'])
# Execute the action by changing its state to STARTING
# Execute the action by changing its state to TRIGGERED
_, updated_ap = self.client.update_action_plan(
action_plan['uuid'],
patch=[{'path': '/state', 'op': 'replace', 'value': 'STARTING'}]
patch=[{'path': '/state', 'op': 'replace', 'value': 'TRIGGERED'}]
)
self.assertTrue(test.call_until_true(
@ -94,7 +94,7 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest):
))
_, finished_ap = self.client.show_action_plan(action_plan['uuid'])
self.assertIn(updated_ap['state'], ('STARTING', 'ONGOING'))
self.assertIn(updated_ap['state'], ('TRIGGERED', 'ONGOING'))
self.assertEqual(finished_ap['state'], 'SUCCEEDED')

View File

@ -49,10 +49,10 @@ class TestExecuteDummyStrategy(base.BaseInfraOptimScenarioTest):
_, action_plan = self.client.show_action_plan(action_plan['uuid'])
# Execute the action by changing its state to STARTING
# Execute the action by changing its state to TRIGGERED
_, updated_ap = self.client.update_action_plan(
action_plan['uuid'],
patch=[{'path': '/state', 'op': 'replace', 'value': 'STARTING'}]
patch=[{'path': '/state', 'op': 'replace', 'value': 'TRIGGERED'}]
)
def has_finished(action_plan_uuid):
@ -65,5 +65,5 @@ class TestExecuteDummyStrategy(base.BaseInfraOptimScenarioTest):
))
_, finished_ap = self.client.show_action_plan(action_plan['uuid'])
self.assertIn(updated_ap['state'], ('STARTING', 'ONGOING'))
self.assertIn(updated_ap['state'], ('TRIGGERED', 'ONGOING'))
self.assertEqual(finished_ap['state'], 'SUCCEEDED')