diff --git a/devstack/lib/watcher b/devstack/lib/watcher index b2b3a14fe..afda8c0f7 100644 --- a/devstack/lib/watcher +++ b/devstack/lib/watcher @@ -123,6 +123,8 @@ function create_watcher_conf { iniset $WATCHER_CONF oslo_messaging_rabbit rabbit_password $RABBIT_PASSWORD iniset $WATCHER_CONF oslo_messaging_rabbit rabbit_host $RABBIT_HOST + iniset $WATCHER_CONF watcher_goals goals "DUMMY:dummy,BASIC_CONSOLIDATION:basic" + configure_auth_token_middleware $WATCHER_CONF watcher $WATCHER_AUTH_CACHE_DIR configure_auth_token_middleware $WATCHER_CONF watcher $WATCHER_AUTH_CACHE_DIR "watcher_clients_auth" diff --git a/watcher_tempest_plugin/infra_optim_clients.py b/watcher_tempest_plugin/infra_optim_clients.py index 7f32a3702..f508caf5b 100644 --- a/watcher_tempest_plugin/infra_optim_clients.py +++ b/watcher_tempest_plugin/infra_optim_clients.py @@ -29,17 +29,14 @@ CONF = config.CONF @six.add_metaclass(abc.ABCMeta) class BaseManager(clients.Manager): - def __init__(self, credentials, service=None, api_microversions=None): - super(BaseManager, self).__init__( - credentials, service, api_microversions) + def __init__(self, credentials): + super(BaseManager, self).__init__(credentials) self.io_client = ioc.InfraOptimClientJSON( self.auth_provider, 'infra-optim', CONF.identity.region) class AdminManager(BaseManager): - def __init__(self, service=None, api_microversions=None): + def __init__(self): super(AdminManager, self).__init__( creds_factory.get_configured_credentials('identity_admin'), - service, - api_microversions ) diff --git a/watcher_tempest_plugin/services/infra_optim/base.py b/watcher_tempest_plugin/services/infra_optim/base.py index 1b67eaa2d..d2487748c 100644 --- a/watcher_tempest_plugin/services/infra_optim/base.py +++ b/watcher_tempest_plugin/services/infra_optim/base.py @@ -20,7 +20,7 @@ import functools import six import six.moves.urllib.parse as urlparse -from tempest.common import service_client +from tempest.lib.common import rest_client def handle_errors(f): @@ -44,7 +44,7 @@ def handle_errors(f): @six.add_metaclass(abc.ABCMeta) -class BaseInfraOptimClient(service_client.ServiceClient): +class BaseInfraOptimClient(rest_client.RestClient): """Base Tempest REST client for Watcher API.""" URI_PREFIX = '' @@ -116,7 +116,7 @@ class BaseInfraOptimClient(service_client.ServiceClient): uri += "?%s" % urlparse.urlencode(kwargs) resp, body = self.get(uri) - self.expected_success(200, resp['status']) + self.expected_success(200, int(resp['status'])) return resp, self.deserialize(body) @@ -132,7 +132,7 @@ class BaseInfraOptimClient(service_client.ServiceClient): else: uri = self._get_uri(resource, uuid=uuid, permanent=permanent) resp, body = self.get(uri) - self.expected_success(200, resp['status']) + self.expected_success(200, int(resp['status'])) return resp, self.deserialize(body) @@ -150,7 +150,7 @@ class BaseInfraOptimClient(service_client.ServiceClient): uri = self._get_uri(resource) resp, body = self.post(uri, body=body) - self.expected_success(201, resp['status']) + self.expected_success(201, int(resp['status'])) return resp, self.deserialize(body) @@ -165,7 +165,7 @@ class BaseInfraOptimClient(service_client.ServiceClient): uri = self._get_uri(resource, uuid) resp, body = self.delete(uri) - self.expected_success(204, resp['status']) + self.expected_success(204, int(resp['status'])) return resp, body def _patch_request(self, resource, uuid, patch_object): @@ -181,7 +181,7 @@ class BaseInfraOptimClient(service_client.ServiceClient): patch_body = self.serialize(patch_object) resp, body = self.patch(uri, body=patch_body) - self.expected_success(200, resp['status']) + self.expected_success(200, int(resp['status'])) return resp, self.deserialize(body) @handle_errors @@ -207,5 +207,5 @@ class BaseInfraOptimClient(service_client.ServiceClient): put_body = self.serialize(put_object) resp, body = self.put(uri, body=put_body) - self.expected_success(202, resp['status']) + self.expected_success(202, int(resp['status'])) return resp, body 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 44846c89a..da0a85b66 100644 --- a/watcher_tempest_plugin/tests/api/admin/test_action_plan.py +++ b/watcher_tempest_plugin/tests/api/admin/test_action_plan.py @@ -18,8 +18,8 @@ from __future__ import unicode_literals import functools +from tempest.lib import exceptions from tempest import test -from tempest_lib import exceptions as lib_exc from watcher_tempest_plugin.tests.api.admin import base @@ -64,7 +64,7 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest): self.client.delete_action_plan(action_plan['uuid']) - self.assertRaises(lib_exc.NotFound, self.client.show_action_plan, + self.assertRaises(exceptions.NotFound, self.client.show_action_plan, action_plan['uuid']) @test.attr(type='smoke') diff --git a/watcher_tempest_plugin/tests/api/admin/test_audit.py b/watcher_tempest_plugin/tests/api/admin/test_audit.py index 6292e2ced..c956ea222 100644 --- a/watcher_tempest_plugin/tests/api/admin/test_audit.py +++ b/watcher_tempest_plugin/tests/api/admin/test_audit.py @@ -16,9 +16,9 @@ from __future__ import unicode_literals +from tempest.lib import decorators +from tempest.lib import exceptions from tempest import test -from tempest_lib import decorators -from tempest_lib import exceptions as lib_exc from watcher_tempest_plugin.tests.api.admin import base @@ -70,7 +70,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest): ) self.assertRaises( - lib_exc.BadRequest, self.create_audit, **audit_params) + exceptions.BadRequest, self.create_audit, **audit_params) @decorators.skip_because(bug="1532843") @test.attr(type='smoke') @@ -83,7 +83,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest): ) self.assertRaises( - lib_exc.BadRequest, self.create_audit, **audit_params) + exceptions.BadRequest, self.create_audit, **audit_params) @decorators.skip_because(bug="1533210") @test.attr(type='smoke') @@ -113,7 +113,8 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest): self.delete_audit(audit_uuid) - self.assertRaises(lib_exc.NotFound, self.client.show_audit, audit_uuid) + self.assertRaises( + exceptions.NotFound, self.client.show_audit, audit_uuid) class TestShowListAudit(base.BaseInfraOptimTest): diff --git a/watcher_tempest_plugin/tests/api/admin/test_audit_template.py b/watcher_tempest_plugin/tests/api/admin/test_audit_template.py index a676de297..19727b095 100644 --- a/watcher_tempest_plugin/tests/api/admin/test_audit_template.py +++ b/watcher_tempest_plugin/tests/api/admin/test_audit_template.py @@ -18,8 +18,8 @@ from __future__ import unicode_literals import uuid +from tempest.lib import exceptions from tempest import test -from tempest_lib import exceptions as lib_exc from watcher_tempest_plugin.tests.api.admin import base @@ -65,7 +65,7 @@ class TestCreateDeleteAuditTemplate(base.BaseInfraOptimTest): self.delete_audit_template(audit_uuid) - self.assertRaises(lib_exc.NotFound, self.client.show_audit_template, + self.assertRaises(exceptions.NotFound, self.client.show_audit_template, audit_uuid)