Fix test_action_plan functional tests

Change-Id: Ie5b5bd330c68b696dce48e2475baf77a81f2e8c4
Closes-Bug: #1744262
This commit is contained in:
Alexander Chadin
2018-01-19 12:48:26 +03:00
parent 15d7d78b8b
commit 9d301fa14a

View File

@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import time
from oslo_utils import uuidutils from oslo_utils import uuidutils
from watcherclient.tests.functional.v1 import base from watcherclient.tests.functional.v1 import base
@@ -44,6 +46,15 @@ class ActionPlanTests(base.TestCase):
output = cls.parse_show( output = cls.parse_show(
cls.watcher('actionplan list --audit %s' % cls.audit_uuid)) cls.watcher('actionplan list --audit %s' % cls.audit_uuid))
action_plan_uuid = output[0].keys()[0] 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) raw_output = cls.watcher('actionplan delete %s' % action_plan_uuid)
cls.assertOutput('', raw_output) cls.assertOutput('', raw_output)
# Delete audit # Delete audit