Merge "Action Plan state - Changed STARTING to TRIGGERED"
This commit is contained in:
commit
9e5a3708e1
@ -386,7 +386,8 @@ class ActionPlansController(rest.RestController):
|
|||||||
if action_plan_to_update[field] != patch_val:
|
if action_plan_to_update[field] != patch_val:
|
||||||
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
|
launch_action_plan = True
|
||||||
|
|
||||||
action_plan_to_update.save()
|
action_plan_to_update.save()
|
||||||
|
@ -77,6 +77,7 @@ from watcher.objects import utils as obj_utils
|
|||||||
|
|
||||||
class State(object):
|
class State(object):
|
||||||
RECOMMENDED = 'RECOMMENDED'
|
RECOMMENDED = 'RECOMMENDED'
|
||||||
|
TRIGGERED = 'TRIGGERED'
|
||||||
ONGOING = 'ONGOING'
|
ONGOING = 'ONGOING'
|
||||||
FAILED = 'FAILED'
|
FAILED = 'FAILED'
|
||||||
SUCCEEDED = 'SUCCEEDED'
|
SUCCEEDED = 'SUCCEEDED'
|
||||||
|
@ -419,7 +419,7 @@ class TestPatch(api_base.FunctionalTest):
|
|||||||
def test_replace_ok_state_starting(self):
|
def test_replace_ok_state_starting(self):
|
||||||
with mock.patch.object(aapi.ApplierAPI,
|
with mock.patch.object(aapi.ApplierAPI,
|
||||||
'launch_action_plan') as applier_mock:
|
'launch_action_plan') as applier_mock:
|
||||||
new_state = 'STARTING'
|
new_state = objects.action_plan.State.TRIGGERED
|
||||||
response = self.get_json(
|
response = self.get_json(
|
||||||
'/action_plans/%s' % self.action_plan.uuid)
|
'/action_plans/%s' % self.action_plan.uuid)
|
||||||
self.assertNotEqual(new_state, response['state'])
|
self.assertNotEqual(new_state, response['state'])
|
||||||
|
@ -80,10 +80,10 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest):
|
|||||||
|
|
||||||
_, action_plan = self.client.show_action_plan(action_plan['uuid'])
|
_, 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(
|
_, updated_ap = self.client.update_action_plan(
|
||||||
action_plan['uuid'],
|
action_plan['uuid'],
|
||||||
patch=[{'path': '/state', 'op': 'replace', 'value': 'STARTING'}]
|
patch=[{'path': '/state', 'op': 'replace', 'value': 'TRIGGERED'}]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(test.call_until_true(
|
self.assertTrue(test.call_until_true(
|
||||||
@ -94,7 +94,7 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest):
|
|||||||
))
|
))
|
||||||
_, finished_ap = self.client.show_action_plan(action_plan['uuid'])
|
_, 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')
|
self.assertEqual(finished_ap['state'], 'SUCCEEDED')
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,10 +49,10 @@ class TestExecuteDummyStrategy(base.BaseInfraOptimScenarioTest):
|
|||||||
|
|
||||||
_, action_plan = self.client.show_action_plan(action_plan['uuid'])
|
_, 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(
|
_, updated_ap = self.client.update_action_plan(
|
||||||
action_plan['uuid'],
|
action_plan['uuid'],
|
||||||
patch=[{'path': '/state', 'op': 'replace', 'value': 'STARTING'}]
|
patch=[{'path': '/state', 'op': 'replace', 'value': 'TRIGGERED'}]
|
||||||
)
|
)
|
||||||
|
|
||||||
def has_finished(action_plan_uuid):
|
def has_finished(action_plan_uuid):
|
||||||
@ -65,5 +65,5 @@ class TestExecuteDummyStrategy(base.BaseInfraOptimScenarioTest):
|
|||||||
))
|
))
|
||||||
_, finished_ap = self.client.show_action_plan(action_plan['uuid'])
|
_, 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')
|
self.assertEqual(finished_ap['state'], 'SUCCEEDED')
|
||||||
|
Loading…
Reference in New Issue
Block a user