Upgrade Watcher Tempest tests for multinode
Change-Id: I4b84ba9814227776232c8ab883cdaaf411930ee6
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user