Add action plan SUPERSEDED state

An action plan can be now go to SUPERSEDED state if another
action plan is on going for instance. It could be the case with
tempest test, because we can have several scenario tests running
at the same time.

Change-Id: I5449e545676463f0ea601e67993e9dffa67929a7
Closes-bug: #1657031
This commit is contained in:
David TARDIVEL 2017-01-17 09:41:19 +01:00
parent fc9eb6e995
commit a48a16596f
5 changed files with 6 additions and 5 deletions

View File

@ -28,7 +28,7 @@ class BaseInfraOptimTest(test.BaseTestCase):
# States where the object is waiting for some event to perform a transition # States where the object is waiting for some event to perform a transition
IDLE_STATES = ('RECOMMENDED', 'FAILED', 'SUCCEEDED', 'CANCELLED') IDLE_STATES = ('RECOMMENDED', 'FAILED', 'SUCCEEDED', 'CANCELLED')
# States where the object can only be DELETED (end of its life-cycle) # States where the object can only be DELETED (end of its life-cycle)
FINISHED_STATES = ('FAILED', 'SUCCEEDED', 'CANCELLED') FINISHED_STATES = ('FAILED', 'SUCCEEDED', 'CANCELLED', 'SUPERSEDED')
@classmethod @classmethod
def setup_credentials(cls): def setup_credentials(cls):

View File

@ -101,7 +101,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'], ('PENDING', 'ONGOING')) self.assertIn(updated_ap['state'], ('PENDING', 'ONGOING'))
self.assertEqual('SUCCEEDED', finished_ap['state']) self.assertIn(finished_ap['state'], ('SUCCEEDED', 'SUPERSEDED'))
class TestShowListActionPlan(base.BaseInfraOptimTest): class TestShowListActionPlan(base.BaseInfraOptimTest):

View File

@ -155,4 +155,5 @@ class BaseInfraOptimScenarioTest(manager.ScenarioTest):
def has_action_plan_finished(self, action_plan_uuid): def has_action_plan_finished(self, action_plan_uuid):
_, action_plan = self.client.show_action_plan(action_plan_uuid) _, action_plan = self.client.show_action_plan(action_plan_uuid)
return action_plan.get('state') in ('FAILED', 'SUCCEEDED', 'CANCELLED') return action_plan.get('state') in ('FAILED', 'SUCCEEDED', 'CANCELLED',
'SUPERSEDED')

View File

@ -175,7 +175,7 @@ class TestExecuteBasicStrategy(base.BaseInfraOptimScenarioTest):
action_plan_uuid=finished_ap["uuid"]) action_plan_uuid=finished_ap["uuid"])
self.assertIn(updated_ap['state'], ('PENDING', 'ONGOING')) self.assertIn(updated_ap['state'], ('PENDING', 'ONGOING'))
self.assertEqual('SUCCEEDED', finished_ap['state']) self.assertIn(finished_ap['state'], ('SUCCEEDED', 'SUPERSEDED'))
for action in action_list['actions']: for action in action_list['actions']:
self.assertEqual('SUCCEEDED', action.get('state')) self.assertEqual('SUCCEEDED', action.get('state'))

View File

@ -72,7 +72,7 @@ class TestExecuteDummyStrategy(base.BaseInfraOptimScenarioTest):
act['action_type'] for act in action_list['actions']) act['action_type'] for act in action_list['actions'])
self.assertIn(updated_ap['state'], ('PENDING', 'ONGOING')) self.assertIn(updated_ap['state'], ('PENDING', 'ONGOING'))
self.assertEqual('SUCCEEDED', finished_ap['state']) self.assertIn(finished_ap['state'], ('SUCCEEDED', 'SUPERSEDED'))
# A dummy strategy generates 2 "nop" actions and 1 "sleep" action # A dummy strategy generates 2 "nop" actions and 1 "sleep" action
self.assertEqual(3, len(action_list['actions'])) self.assertEqual(3, len(action_list['actions']))