diff --git a/watcher_tempest_plugin/tests/api/admin/base.py b/watcher_tempest_plugin/tests/api/admin/base.py index d591035..75e57b9 100644 --- a/watcher_tempest_plugin/tests/api/admin/base.py +++ b/watcher_tempest_plugin/tests/api/admin/base.py @@ -81,12 +81,16 @@ class BaseInfraOptimTest(test.BaseTestCase): ap['uuid'] for ap in action_plans['action_plans']) for action_plan in action_plans['action_plans']: - test_utils.call_until_true( - func=functools.partial( - cls.is_action_plan_idle, action_plan['uuid']), - duration=30, - sleep_for=.5 - ) + try: + test_utils.call_until_true( + func=functools.partial( + cls.is_action_plan_idle, action_plan['uuid']), + duration=30, + sleep_for=.5 + ) + except Exception: + action_plans_to_be_deleted.remove( + action_plan['uuid']) # Phase 2: Delete them all for action_plan_uuid in action_plans_to_be_deleted: 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 532221e..b31b5df 100644 --- a/watcher_tempest_plugin/tests/api/admin/test_action_plan.py +++ b/watcher_tempest_plugin/tests/api/admin/test_action_plan.py @@ -124,7 +124,8 @@ class TestShowListActionPlan(base.BaseInfraOptimTest): ) _, action_plans = cls.client.list_action_plans( audit_uuid=cls.audit['uuid']) - cls.action_plan = action_plans['action_plans'][0] + if len(action_plans['action_plans']) > 0: + cls.action_plan = action_plans['action_plans'][0] @decorators.attr(type='smoke') def test_show_action_plan(self): diff --git a/watcher_tempest_plugin/tests/api/admin/test_service.py b/watcher_tempest_plugin/tests/api/admin/test_service.py index 3d1d831..948d8b1 100644 --- a/watcher_tempest_plugin/tests/api/admin/test_service.py +++ b/watcher_tempest_plugin/tests/api/admin/test_service.py @@ -38,7 +38,15 @@ class TestShowListService(base.BaseInfraOptimTest): @decorators.attr(type='smoke') def test_show_service(self): - _, service = self.client.show_service(self.DECISION_ENGINE) + _, body = self.client.list_services() + self.assertIn('services', body) + services = body['services'] + self.assertIn(self.DECISION_ENGINE, + [i['name'] for i in body['services']]) + + service_id = filter(lambda x: self.DECISION_ENGINE == x['name'], + services)[0]['id'] + _, service = self.client.show_service(service_id) self.assertEqual(self.DECISION_ENGINE, service['name']) self.assertIn("host", service.keys()) @@ -47,7 +55,16 @@ class TestShowListService(base.BaseInfraOptimTest): @decorators.attr(type='smoke') def test_show_service_with_links(self): - _, service = self.client.show_service(self.DECISION_ENGINE) + _, body = self.client.list_services() + self.assertIn('services', body) + services = body['services'] + self.assertIn(self.DECISION_ENGINE, + [i['name'] for i in body['services']]) + + service_id = filter(lambda x: self.DECISION_ENGINE == x['name'], + services)[0]['id'] + _, service = self.client.show_service(service_id) + self.assertIn('links', service.keys()) self.assertEqual(2, len(service['links'])) self.assertIn(str(service['id']),