From 9d301fa14adb69053d0c91312479abb85cabfae2 Mon Sep 17 00:00:00 2001 From: Alexander Chadin Date: Fri, 19 Jan 2018 12:48:26 +0300 Subject: [PATCH] Fix test_action_plan functional tests Change-Id: Ie5b5bd330c68b696dce48e2475baf77a81f2e8c4 Closes-Bug: #1744262 --- watcherclient/tests/functional/v1/test_action_plan.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/watcherclient/tests/functional/v1/test_action_plan.py b/watcherclient/tests/functional/v1/test_action_plan.py index d4e4632..c974db7 100644 --- a/watcherclient/tests/functional/v1/test_action_plan.py +++ b/watcherclient/tests/functional/v1/test_action_plan.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import time + from oslo_utils import uuidutils from watcherclient.tests.functional.v1 import base @@ -44,6 +46,15 @@ class ActionPlanTests(base.TestCase): output = cls.parse_show( cls.watcher('actionplan list --audit %s' % cls.audit_uuid)) action_plan_uuid = output[0].keys()[0] + retry = 10 + while retry > 0: + output = cls.parse_show( + cls.watcher('actionplan show %s' % action_plan_uuid)) + state = [x for x in output if x.keys()[0] == 'State'][0]['State'] + if state == 'SUCCEEDED': + break + time.sleep(1) + retry -= 1 raw_output = cls.watcher('actionplan delete %s' % action_plan_uuid) cls.assertOutput('', raw_output) # Delete audit