Merge "Cleanup irrelevant-files list in .zuul.yaml"
diff --git a/REVIEWING.rst b/REVIEWING.rst
index 8a1e152..bf63ed2 100644
--- a/REVIEWING.rst
+++ b/REVIEWING.rst
@@ -36,8 +36,11 @@
For any change that adds new functionality to either common functionality or an
out-of-band tool unit tests are required. This is to ensure we don't introduce
future regressions and to test conditions which we may not hit in the gate runs.
-Tests, and service clients aren't required to have unit tests since they should
-be self verifying by running them in the gate.
+API and scenario tests aren't required to have unit tests since they should
+be self-verifying by running them in the gate. All service clients, on the
+other hand, `must have`_ unit tests, as they belong to ``tempest/lib``.
+
+.. _must have: https://docs.openstack.org/tempest/latest/library.html#testing
API Stability
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index 9be8ee2..e41aa86 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -195,7 +195,6 @@
if test_resource.network:
account['resources'] = {}
- if test_resource.network:
account['resources']['network'] = test_resource.network['name']
accounts.append(account)
if os.path.exists(account_file):
diff --git a/tempest/lib/api_schema/response/volume/qos.py b/tempest/lib/api_schema/response/volume/qos.py
new file mode 100644
index 0000000..d1b3910
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/qos.py
@@ -0,0 +1,123 @@
+# Copyright 2018 ZTE Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+show_qos = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'qos_specs': {
+ 'type': 'object',
+ 'properties': {
+ 'name': {'type': 'string'},
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'consumer': {'type': 'string'},
+ 'specs': {'type': ['object', 'null']},
+ },
+ 'additionalProperties': False,
+ 'required': ['name', 'id', 'specs']
+ },
+ 'links': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'href': {'type': 'string',
+ 'format': 'uri'},
+ 'rel': {'type': 'string'},
+ },
+ 'additionalProperties': False,
+ 'required': ['href', 'rel']
+ }
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['qos_specs', 'links']
+ }
+}
+
+delete_qos = {'status_code': [202]}
+
+list_qos = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'qos_specs': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'specs': {
+ 'type': 'object',
+ 'patternProperties': {'^.+$': {'type': 'string'}}
+ },
+ 'consumer': {'type': 'string'},
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'name': {'type': 'string'}
+ },
+ 'additionalProperties': False,
+ 'required': ['specs', 'id', 'name']
+ }
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['qos_specs']
+ }
+}
+
+set_qos_key = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'qos_specs': {
+ 'type': 'object',
+ 'patternProperties': {'^.+$': {'type': 'string'}}
+ },
+ },
+ 'additionalProperties': False,
+ 'required': ['qos_specs']
+ }
+}
+
+unset_qos_key = {'status_code': [202]}
+associate_qos = {'status_code': [202]}
+
+show_association_qos = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'qos_associations': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'association_type': {'type': 'string'},
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'name': {'type': 'string'}
+ },
+ 'additionalProperties': False,
+ 'required': ['association_type', 'id', 'name']
+ }
+ },
+ },
+ 'additionalProperties': False,
+ 'required': ['qos_associations']
+ }
+}
+
+disassociate_qos = {'status_code': [202]}
+disassociate_all_qos = {'status_code': [202]}
diff --git a/tempest/lib/services/volume/v3/qos_client.py b/tempest/lib/services/volume/v3/qos_client.py
index 8f4d37f..5205590 100644
--- a/tempest/lib/services/volume/v3/qos_client.py
+++ b/tempest/lib/services/volume/v3/qos_client.py
@@ -14,6 +14,7 @@
from oslo_serialization import jsonutils as json
+from tempest.lib.api_schema.response.volume import qos as schema
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
@@ -45,15 +46,15 @@
"""
post_body = json.dumps({'qos_specs': kwargs})
resp, body = self.post('qos-specs', post_body)
- self.expected_success(200, resp.status)
body = json.loads(body)
+ self.validate_response(schema.show_qos, resp, body)
return rest_client.ResponseBody(resp, body)
def delete_qos(self, qos_id, force=False):
"""Delete the specified QoS specification."""
resp, body = self.delete(
"qos-specs/%s?force=%s" % (qos_id, force))
- self.expected_success(202, resp.status)
+ self.validate_response(schema.delete_qos, resp, body)
return rest_client.ResponseBody(resp, body)
def list_qos(self):
@@ -61,7 +62,7 @@
url = 'qos-specs'
resp, body = self.get(url)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(schema.list_qos, resp, body)
return rest_client.ResponseBody(resp, body)
def show_qos(self, qos_id):
@@ -69,7 +70,7 @@
url = "qos-specs/%s" % qos_id
resp, body = self.get(url)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(schema.show_qos, resp, body)
return rest_client.ResponseBody(resp, body)
def set_qos_key(self, qos_id, **kwargs):
@@ -82,7 +83,7 @@
put_body = json.dumps({"qos_specs": kwargs})
resp, body = self.put('qos-specs/%s' % qos_id, put_body)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(schema.set_qos_key, resp, body)
return rest_client.ResponseBody(resp, body)
def unset_qos_key(self, qos_id, keys):
@@ -96,7 +97,7 @@
"""
put_body = json.dumps({'keys': keys})
resp, body = self.put('qos-specs/%s/delete_keys' % qos_id, put_body)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.unset_qos_key, resp, body)
return rest_client.ResponseBody(resp, body)
def associate_qos(self, qos_id, vol_type_id):
@@ -104,7 +105,7 @@
url = "qos-specs/%s/associate" % qos_id
url += "?vol_type_id=%s" % vol_type_id
resp, body = self.get(url)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.associate_qos, resp, body)
return rest_client.ResponseBody(resp, body)
def show_association_qos(self, qos_id):
@@ -112,7 +113,7 @@
url = "qos-specs/%s/associations" % qos_id
resp, body = self.get(url)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(schema.show_association_qos, resp, body)
return rest_client.ResponseBody(resp, body)
def disassociate_qos(self, qos_id, vol_type_id):
@@ -120,12 +121,12 @@
url = "qos-specs/%s/disassociate" % qos_id
url += "?vol_type_id=%s" % vol_type_id
resp, body = self.get(url)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.disassociate_qos, resp, body)
return rest_client.ResponseBody(resp, body)
def disassociate_all_qos(self, qos_id):
"""Disassociate the specified QoS with all associations."""
url = "qos-specs/%s/disassociate_all" % qos_id
resp, body = self.get(url)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.disassociate_all_qos, resp, body)
return rest_client.ResponseBody(resp, body)