From a48a16596f437ba48fe1a9523ec9ad92626f4607 Mon Sep 17 00:00:00 2001 From: David TARDIVEL Date: Tue, 17 Jan 2017 09:41:19 +0100 Subject: [PATCH] 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 --- watcher_tempest_plugin/tests/api/admin/base.py | 2 +- watcher_tempest_plugin/tests/api/admin/test_action_plan.py | 2 +- watcher_tempest_plugin/tests/scenario/base.py | 3 ++- .../tests/scenario/test_execute_basic_optim.py | 2 +- .../tests/scenario/test_execute_dummy_optim.py | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/watcher_tempest_plugin/tests/api/admin/base.py b/watcher_tempest_plugin/tests/api/admin/base.py index 23624cc46..2c7b618dd 100644 --- a/watcher_tempest_plugin/tests/api/admin/base.py +++ b/watcher_tempest_plugin/tests/api/admin/base.py @@ -28,7 +28,7 @@ class BaseInfraOptimTest(test.BaseTestCase): # States where the object is waiting for some event to perform a transition IDLE_STATES = ('RECOMMENDED', 'FAILED', 'SUCCEEDED', 'CANCELLED') # 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 def setup_credentials(cls): diff --git a/watcher_tempest_plugin/tests/api/admin/test_action_plan.py b/watcher_tempest_plugin/tests/api/admin/test_action_plan.py index 9bc4add8d..710b19b64 100644 --- a/watcher_tempest_plugin/tests/api/admin/test_action_plan.py +++ b/watcher_tempest_plugin/tests/api/admin/test_action_plan.py @@ -101,7 +101,7 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest): _, finished_ap = self.client.show_action_plan(action_plan['uuid']) self.assertIn(updated_ap['state'], ('PENDING', 'ONGOING')) - self.assertEqual('SUCCEEDED', finished_ap['state']) + self.assertIn(finished_ap['state'], ('SUCCEEDED', 'SUPERSEDED')) class TestShowListActionPlan(base.BaseInfraOptimTest): diff --git a/watcher_tempest_plugin/tests/scenario/base.py b/watcher_tempest_plugin/tests/scenario/base.py index faaf2cee9..a166d1709 100644 --- a/watcher_tempest_plugin/tests/scenario/base.py +++ b/watcher_tempest_plugin/tests/scenario/base.py @@ -155,4 +155,5 @@ class BaseInfraOptimScenarioTest(manager.ScenarioTest): def has_action_plan_finished(self, 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') diff --git a/watcher_tempest_plugin/tests/scenario/test_execute_basic_optim.py b/watcher_tempest_plugin/tests/scenario/test_execute_basic_optim.py index b0175980a..c20123bc5 100644 --- a/watcher_tempest_plugin/tests/scenario/test_execute_basic_optim.py +++ b/watcher_tempest_plugin/tests/scenario/test_execute_basic_optim.py @@ -175,7 +175,7 @@ class TestExecuteBasicStrategy(base.BaseInfraOptimScenarioTest): action_plan_uuid=finished_ap["uuid"]) 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']: self.assertEqual('SUCCEEDED', action.get('state')) diff --git a/watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py b/watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py index 247acad91..bd016c275 100644 --- a/watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py +++ b/watcher_tempest_plugin/tests/scenario/test_execute_dummy_optim.py @@ -72,7 +72,7 @@ class TestExecuteDummyStrategy(base.BaseInfraOptimScenarioTest): act['action_type'] for act in action_list['actions']) 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 self.assertEqual(3, len(action_list['actions']))