Merge "Add api-ref urls for some volume v2 APIs"
diff --git a/doc/source/microversion_testing.rst b/doc/source/microversion_testing.rst
index b516055..d6d90ba 100644
--- a/doc/source/microversion_testing.rst
+++ b/doc/source/microversion_testing.rst
@@ -326,6 +326,14 @@
.. _2.42: http://docs.openstack.org/developer/nova/api_microversion_history.html#maximum-in-ocata
+ * `2.47`_
+
+ .. _2.47: http://docs.openstack.org/developer/nova/api_microversion_history.html#id42
+
+ * `2.48`_
+
+ .. _2.48: http://docs.openstack.org/developer/nova/api_microversion_history.html#id43
+
* Volume
* `3.3`_
diff --git a/releasenotes/notes/add-server-diagnostics-validation-schema-b5a3c55b45aa718a.yaml b/releasenotes/notes/add-server-diagnostics-validation-schema-b5a3c55b45aa718a.yaml
new file mode 100644
index 0000000..e0ac87c
--- /dev/null
+++ b/releasenotes/notes/add-server-diagnostics-validation-schema-b5a3c55b45aa718a.yaml
@@ -0,0 +1,4 @@
+---
+features:
+ - |
+ Add validation schema for Nova server diagnostics API
\ No newline at end of file
diff --git a/tempest/api/compute/admin/test_server_diagnostics.py b/tempest/api/compute/admin/test_server_diagnostics.py
new file mode 100644
index 0000000..005efdd
--- /dev/null
+++ b/tempest/api/compute/admin/test_server_diagnostics.py
@@ -0,0 +1,76 @@
+# Copyright 2017 Mirantis Inc.
+#
+# 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.
+
+import time
+
+from tempest.api.compute import base
+from tempest.lib import decorators
+
+
+class ServerDiagnosticsTest(base.BaseV2ComputeAdminTest):
+ min_microversion = None
+ max_microversion = '2.47'
+
+ @classmethod
+ def setup_clients(cls):
+ super(ServerDiagnosticsTest, cls).setup_clients()
+ cls.client = cls.os_admin.servers_client
+
+ @decorators.idempotent_id('31ff3486-b8a0-4f56-a6c0-aab460531db3')
+ def test_get_server_diagnostics(self):
+ server_id = self.create_test_server(wait_until='ACTIVE')['id']
+ diagnostics = self.client.show_server_diagnostics(server_id)
+
+ # NOTE(snikitin): Before microversion 2.48 response data from each
+ # hypervisor (libvirt, xen, vmware) was different. None of the fields
+ # were equal. As this test is common for libvirt, xen and vmware CI
+ # jobs we can't check any field in the response because all fields are
+ # different.
+ self.assertNotEmpty(diagnostics)
+
+
+class ServerDiagnosticsV248Test(base.BaseV2ComputeAdminTest):
+ min_microversion = '2.48'
+ max_microversion = 'latest'
+
+ @classmethod
+ def setup_clients(cls):
+ super(ServerDiagnosticsV248Test, cls).setup_clients()
+ cls.client = cls.os_admin.servers_client
+
+ @decorators.idempotent_id('64d0d48c-dff1-11e6-bf01-fe55135034f3')
+ def test_get_server_diagnostics(self):
+ server_id = self.create_test_server(wait_until='ACTIVE')['id']
+ # Response status and filed types will be checked by json schema
+ self.client.show_server_diagnostics(server_id)
+
+ # NOTE(snikitin): This is a special case for Xen hypervisor. In Xen
+ # case we're getting diagnostics stats from the RRDs which are updated
+ # every 5 seconds. It means that diagnostics information may be
+ # incomplete during first 5 seconds of VM life. In such cases methods
+ # which get diagnostics stats from Xen may raise exceptions or
+ # return `NaN` values. Such behavior must be handled correctly.
+ # Response must contain all diagnostics fields (may be with `None`
+ # values) and response status must be 200. Line above checks it by
+ # json schema.
+ time.sleep(10)
+ diagnostics = self.client.show_server_diagnostics(server_id)
+
+ # NOTE(snikitin): After 10 seconds diagnostics fields must contain
+ # not None values. But we will check only "memory_details.maximum"
+ # field because only this field meets all the following conditions:
+ # 1) This field may be unset because of Xen 5 seconds timeout.
+ # 2) This field is present in responses from all three supported
+ # hypervisors (libvirt, xen, vmware).
+ self.assertIsNotNone(diagnostics['memory_details']['maximum'])
diff --git a/tempest/api/compute/admin/test_server_diagnostics_negative.py b/tempest/api/compute/admin/test_server_diagnostics_negative.py
new file mode 100644
index 0000000..d5b6674
--- /dev/null
+++ b/tempest/api/compute/admin/test_server_diagnostics_negative.py
@@ -0,0 +1,40 @@
+# Copyright 2017 Mirantis Inc.
+#
+# 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.
+
+from tempest.api.compute import base
+from tempest.lib import decorators
+from tempest.lib import exceptions as lib_exc
+
+
+class ServerDiagnosticsNegativeTest(base.BaseV2ComputeAdminTest):
+ min_microversion = None
+ max_microversion = '2.47'
+
+ @classmethod
+ def setup_clients(cls):
+ super(ServerDiagnosticsNegativeTest, cls).setup_clients()
+ cls.client = cls.servers_client
+
+ @decorators.attr(type=['negative'])
+ @decorators.idempotent_id('e84e2234-60d2-42fa-8b30-e2d3049724ac')
+ def test_get_server_diagnostics_by_non_admin(self):
+ # Non-admin user cannot view server diagnostics according to policy
+ server_id = self.create_test_server(wait_until='ACTIVE')['id']
+ self.assertRaises(lib_exc.Forbidden,
+ self.client.show_server_diagnostics, server_id)
+
+
+class ServerDiagnosticsNegativeV248Test(ServerDiagnosticsNegativeTest):
+ min_microversion = '2.48'
+ max_microversion = 'latest'
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 789049b..0521cca 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -164,17 +164,6 @@
server = self.client.show_server(self.s1_id)['server']
self.assertEqual(server['status'], 'ACTIVE')
- @decorators.skip_because(bug="1240043")
- @decorators.idempotent_id('31ff3486-b8a0-4f56-a6c0-aab460531db3')
- def test_get_server_diagnostics_by_admin(self):
- # Retrieve server diagnostics by admin user
- diagnostic = self.client.show_server_diagnostics(self.s1_id)
- basic_attrs = ['rx_packets', 'rx_errors', 'rx_drop',
- 'tx_packets', 'tx_errors', 'tx_drop',
- 'read_req', 'write_req', 'cpu', 'memory']
- for key in basic_attrs:
- self.assertIn(key, str(diagnostic.keys()))
-
@decorators.idempotent_id('682cb127-e5bb-4f53-87ce-cb9003604442')
def test_rebuild_server_in_error_state(self):
# The server in error state should be rebuilt using the provided
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index ca53696..9023759 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -108,14 +108,6 @@
self.client.reset_state, '999', state='error')
@decorators.attr(type=['negative'])
- @decorators.idempotent_id('e84e2234-60d2-42fa-8b30-e2d3049724ac')
- def test_get_server_diagnostics_by_non_admin(self):
- # Non-admin user can not view server diagnostics according to policy
- self.assertRaises(lib_exc.Forbidden,
- self.non_adm_client.show_server_diagnostics,
- self.s1_id)
-
- @decorators.attr(type=['negative'])
@decorators.idempotent_id('46a4e1ca-87ae-4d28-987a-1b6b136a0221')
def test_migrate_non_existent_server(self):
# migrate a non existent server
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index d893446..429ded5 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -22,6 +22,7 @@
from tempest.common import waiters
from tempest import config
from tempest import exceptions
+from tempest.lib.common import api_version_request
from tempest.lib.common import api_version_utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
@@ -202,6 +203,15 @@
"""
if 'name' not in kwargs:
kwargs['name'] = data_utils.rand_name(cls.__name__ + "-server")
+
+ request_version = api_version_request.APIVersionRequest(
+ cls.request_microversion)
+ v2_37_version = api_version_request.APIVersionRequest('2.37')
+
+ # NOTE(snikitin): since microversion v2.37 'networks' field is required
+ if request_version >= v2_37_version and 'networks' not in kwargs:
+ kwargs['networks'] = 'none'
+
tenant_network = cls.get_tenant_network()
body, servers = compute.create_test_server(
cls.os_primary,
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index ea4c141..7fd1dd1 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -134,3 +134,14 @@
waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
server = self.client.show_server(server['id'])['server']
self.assertEqual('2001:2001::3', server['accessIPv6'])
+
+
+class ServerShowV247Test(base.BaseV2ComputeTest):
+ min_microversion = '2.47'
+ max_microversion = 'latest'
+
+ @decorators.idempotent_id('88b0bdb2-494c-11e7-a919-92ebcb67fe33')
+ def test_show_server(self):
+ server = self.create_test_server()
+ # All fields will be checked by API schema
+ self.servers_client.show_server(server['id'])
diff --git a/tempest/api/volume/admin/test_snapshot_manage.py b/tempest/api/volume/admin/test_snapshot_manage.py
index 6c09042..9ff7160 100644
--- a/tempest/api/volume/admin/test_snapshot_manage.py
+++ b/tempest/api/volume/admin/test_snapshot_manage.py
@@ -18,6 +18,7 @@
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
+from tempest.lib import exceptions
CONF = config.CONF
@@ -38,8 +39,9 @@
raise cls.skipException("Manage snapshot tests are disabled")
if len(CONF.volume.manage_snapshot_ref) != 2:
- raise cls.skipException("Manage snapshot ref is not correctly "
- "configured")
+ msg = ("Manage snapshot ref is not correctly configured, "
+ "it should be a list of two elements")
+ raise exceptions.InvalidConfiguration(msg)
@decorators.idempotent_id('0132f42d-0147-4b45-8501-cc504bbf7810')
def test_unmanage_manage_snapshot(self):
diff --git a/tempest/api/volume/admin/test_volume_manage.py b/tempest/api/volume/admin/test_volume_manage.py
index a039085..4b352e0 100644
--- a/tempest/api/volume/admin/test_volume_manage.py
+++ b/tempest/api/volume/admin/test_volume_manage.py
@@ -18,6 +18,7 @@
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
+from tempest.lib import exceptions
CONF = config.CONF
@@ -32,8 +33,9 @@
raise cls.skipException("Manage volume tests are disabled")
if len(CONF.volume.manage_volume_ref) != 2:
- raise cls.skipException("Manage volume ref is not correctly "
- "configured")
+ msg = ("Manage volume ref is not correctly configured, "
+ "it should be a list of two elements")
+ raise exceptions.InvalidConfiguration(msg)
@decorators.idempotent_id('70076c71-0ce1-4208-a8ff-36a66e65cc1e')
def test_unmanage_manage_volume(self):
diff --git a/tempest/lib/api_schema/response/compute/v2_1/servers.py b/tempest/lib/api_schema/response/compute/v2_1/servers.py
index 33a7757..7360396 100644
--- a/tempest/lib/api_schema/response/compute/v2_1/servers.py
+++ b/tempest/lib/api_schema/response/compute/v2_1/servers.py
@@ -582,3 +582,10 @@
'required': ['adminPass']
}
}
+
+show_server_diagnostics = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object'
+ }
+}
diff --git a/tempest/lib/api_schema/response/compute/v2_47/__init__.py b/tempest/lib/api_schema/response/compute/v2_47/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/lib/api_schema/response/compute/v2_47/__init__.py
diff --git a/tempest/lib/api_schema/response/compute/v2_47/servers.py b/tempest/lib/api_schema/response/compute/v2_47/servers.py
new file mode 100644
index 0000000..37a084f
--- /dev/null
+++ b/tempest/lib/api_schema/response/compute/v2_47/servers.py
@@ -0,0 +1,39 @@
+# 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.
+
+import copy
+
+from tempest.lib.api_schema.response.compute.v2_26 import servers as servers226
+
+flavor = {
+ 'type': 'object',
+ 'properties': {
+ 'original_name': {'type': 'string'},
+ 'disk': {'type': 'integer'},
+ 'ephemeral': {'type': 'integer'},
+ 'ram': {'type': 'integer'},
+ 'swap': {'type': 'integer'},
+ 'vcpus': {'type': 'integer'},
+ 'extra_specs': {
+ 'type': 'object',
+ 'patternProperties': {
+ '^[a-zA-Z0-9_\-\. :]+$': {'type': 'string'}
+ }
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['original_name', 'disk', 'ephemeral', 'ram', 'swap', 'vcpus']
+}
+
+get_server = copy.deepcopy(servers226.get_server)
+get_server['response_body']['properties']['server'][
+ 'properties'].update({'flavor': flavor})
diff --git a/tempest/lib/api_schema/response/compute/v2_48/__init__.py b/tempest/lib/api_schema/response/compute/v2_48/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/lib/api_schema/response/compute/v2_48/__init__.py
diff --git a/tempest/lib/api_schema/response/compute/v2_48/servers.py b/tempest/lib/api_schema/response/compute/v2_48/servers.py
new file mode 100644
index 0000000..5904758
--- /dev/null
+++ b/tempest/lib/api_schema/response/compute/v2_48/servers.py
@@ -0,0 +1,115 @@
+# Copyright 2017 Mirantis Inc.
+#
+# 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.
+
+import copy
+
+from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
+from tempest.lib.api_schema.response.compute.v2_47 import servers as servers247
+
+
+show_server_diagnostics = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'state': {
+ 'type': 'string', 'enum': [
+ 'pending', 'running', 'paused', 'shutdown', 'crashed',
+ 'suspended']
+ },
+ 'driver': {
+ 'type': 'string', 'enum': [
+ 'libvirt', 'xenapi', 'vmwareapi', 'ironic', 'hyperv']
+ },
+ 'hypervisor': {'type': ['string', 'null']},
+ 'hypervisor_os': {'type': ['string', 'null']},
+ 'uptime': {'type': ['integer', 'null']},
+ 'config_drive': {'type': 'boolean'},
+ 'num_cpus': {'type': 'integer'},
+ 'num_nics': {'type': 'integer'},
+ 'num_disks': {'type': 'integer'},
+ 'memory_details': {
+ 'type': 'object',
+ 'properties': {
+ 'maximum': {'type': ['integer', 'null']},
+ 'used': {'type': ['integer', 'null']}
+ },
+ 'additionalProperties': False,
+ 'required': ['maximum', 'used']
+ },
+ 'cpu_details': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': ['integer', 'null']},
+ 'time': {'type': ['integer', 'null']},
+ 'utilisation': {'type': ['integer', 'null']}
+ },
+ 'additionalProperties': False,
+ 'required': ['id', 'time', 'utilisation']
+ }
+ },
+ 'nic_details': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'mac_address': {'oneOf': [parameter_types.mac_address,
+ {'type': 'null'}]},
+ 'rx_octets': {'type': ['integer', 'null']},
+ 'rx_errors': {'type': ['integer', 'null']},
+ 'rx_drop': {'type': ['integer', 'null']},
+ 'rx_packets': {'type': ['integer', 'null']},
+ 'rx_rate': {'type': ['integer', 'null']},
+ 'tx_octets': {'type': ['integer', 'null']},
+ 'tx_errors': {'type': ['integer', 'null']},
+ 'tx_drop': {'type': ['integer', 'null']},
+ 'tx_packets': {'type': ['integer', 'null']},
+ 'tx_rate': {'type': ['integer', 'null']}
+ },
+ 'additionalProperties': False,
+ 'required': ['mac_address', 'rx_octets', 'rx_errors',
+ 'rx_drop',
+ 'rx_packets', 'rx_rate', 'tx_octets',
+ 'tx_errors',
+ 'tx_drop', 'tx_packets', 'tx_rate']
+ }
+ },
+ 'disk_details': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'read_bytes': {'type': ['integer', 'null']},
+ 'read_requests': {'type': ['integer', 'null']},
+ 'write_bytes': {'type': ['integer', 'null']},
+ 'write_requests': {'type': ['integer', 'null']},
+ 'errors_count': {'type': ['integer', 'null']}
+ },
+ 'additionalProperties': False,
+ 'required': ['read_bytes', 'read_requests', 'write_bytes',
+ 'write_requests', 'errors_count']
+ }
+ }
+ },
+ 'additionalProperties': False,
+ 'required': [
+ 'state', 'driver', 'hypervisor', 'hypervisor_os', 'uptime',
+ 'config_drive', 'num_cpus', 'num_nics', 'num_disks',
+ 'memory_details', 'cpu_details', 'nic_details', 'disk_details'],
+ }
+}
+
+get_server = copy.deepcopy(servers247.get_server)
diff --git a/tempest/lib/services/compute/servers_client.py b/tempest/lib/services/compute/servers_client.py
index ff65b25..598d5a6 100644
--- a/tempest/lib/services/compute/servers_client.py
+++ b/tempest/lib/services/compute/servers_client.py
@@ -27,6 +27,8 @@
from tempest.lib.api_schema.response.compute.v2_19 import servers as schemav219
from tempest.lib.api_schema.response.compute.v2_26 import servers as schemav226
from tempest.lib.api_schema.response.compute.v2_3 import servers as schemav23
+from tempest.lib.api_schema.response.compute.v2_47 import servers as schemav247
+from tempest.lib.api_schema.response.compute.v2_48 import servers as schemav248
from tempest.lib.api_schema.response.compute.v2_6 import servers as schemav26
from tempest.lib.api_schema.response.compute.v2_9 import servers as schemav29
from tempest.lib.common import rest_client
@@ -43,7 +45,9 @@
{'min': '2.9', 'max': '2.15', 'schema': schemav29},
{'min': '2.16', 'max': '2.18', 'schema': schemav216},
{'min': '2.19', 'max': '2.25', 'schema': schemav219},
- {'min': '2.26', 'max': None, 'schema': schemav226}]
+ {'min': '2.26', 'max': '2.46', 'schema': schemav226},
+ {'min': '2.47', 'max': '2.47', 'schema': schemav247},
+ {'min': '2.48', 'max': None, 'schema': schemav248}]
def __init__(self, auth_provider, service, region,
enable_instance_password=True, **kwargs):
@@ -656,7 +660,10 @@
def show_server_diagnostics(self, server_id):
"""Get the usage data for a server."""
resp, body = self.get("servers/%s/diagnostics" % server_id)
- return rest_client.ResponseBody(resp, json.loads(body))
+ body = json.loads(body)
+ schema = self.get_schema(self.schema_versions_info)
+ self.validate_response(schema.show_server_diagnostics, resp, body)
+ return rest_client.ResponseBody(resp, body)
def list_instance_actions(self, server_id):
"""List the provided server action."""
diff --git a/tempest/tests/lib/services/network/test_quotas_client.py b/tempest/tests/lib/services/network/test_quotas_client.py
new file mode 100644
index 0000000..e76bc9c
--- /dev/null
+++ b/tempest/tests/lib/services/network/test_quotas_client.py
@@ -0,0 +1,99 @@
+# Copyright 2017 AT&T 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.
+
+from tempest.lib.services.network import quotas_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestQuotasClient(base.BaseServiceTest):
+
+ FAKE_QUOTAS = {
+ "quotas": [
+ {
+ "floatingip": 50,
+ "network": 15,
+ "port": 50,
+ "project_id": "bab7d5c60cd041a0a36f7c4b6e1dd978",
+ "rbac_policy": -1,
+ "router": 10,
+ "security_group": 10,
+ "security_group_rule": 100,
+ "subnet": 10,
+ "subnetpool": -1,
+ "tenant_id": "bab7d5c60cd041a0a36f7c4b6e1dd978"
+ }
+ ]
+ }
+
+ FAKE_QUOTA_TENANT_ID = "bab7d5c60cd041a0a36f7c4b6e1dd978"
+
+ def setUp(self):
+ super(TestQuotasClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.quotas_client = quotas_client.QuotasClient(
+ fake_auth, "network", "regionOne")
+
+ def _test_list_quotas(self, bytes_body=False):
+ self.check_service_client_function(
+ self.quotas_client.list_quotas,
+ "tempest.lib.common.rest_client.RestClient.get",
+ self.FAKE_QUOTAS,
+ bytes_body,
+ 200)
+
+ def _test_show_quotas(self, bytes_body=False):
+ self.check_service_client_function(
+ self.quotas_client.show_quotas,
+ "tempest.lib.common.rest_client.RestClient.get",
+ {"quota": self.FAKE_QUOTAS["quotas"][0]},
+ bytes_body,
+ 200,
+ tenant_id=self.FAKE_QUOTA_TENANT_ID)
+
+ def _test_update_quotas(self, bytes_body=False):
+ self.check_service_client_function(
+ self.quotas_client.update_quotas,
+ "tempest.lib.common.rest_client.RestClient.put",
+ {"quota": self.FAKE_QUOTAS["quotas"][0]},
+ bytes_body,
+ 200,
+ tenant_id=self.FAKE_QUOTA_TENANT_ID)
+
+ def test_reset_quotas(self):
+ self.check_service_client_function(
+ self.quotas_client.reset_quotas,
+ "tempest.lib.common.rest_client.RestClient.delete",
+ {},
+ status=204,
+ tenant_id=self.FAKE_QUOTA_TENANT_ID)
+
+ def test_list_quotas_with_str_body(self):
+ self._test_list_quotas()
+
+ def test_list_quotas_with_bytes_body(self):
+ self._test_list_quotas(bytes_body=True)
+
+ def test_show_quotas_with_str_body(self):
+ self._test_show_quotas()
+
+ def test_show_quotas_with_bytes_body(self):
+ self._test_show_quotas(bytes_body=True)
+
+ def test_update_quotas_with_str_body(self):
+ self._test_update_quotas()
+
+ def test_update_quotas_with_bytes_body(self):
+ self._test_update_quotas(bytes_body=True)