From 12b28e993b621493e4514c56d2230c8c0a31dbc5 Mon Sep 17 00:00:00 2001 From: Ken'ichi Ohmichi Date: Wed, 6 Apr 2016 10:43:51 -0700 Subject: [PATCH] Extend T110 check for lib's service clients Current T110 check is just working for tempest.service modules, but we have migrated lib's service clients into tempest.lib.service. So we need to check these modules also on T110. This patch extends the check for these modules. Change-Id: Id102ba359f86bb7417e121e70c707aae36a24740 --- tempest/hacking/checks.py | 2 +- tempest/lib/services/compute/flavors_client.py | 4 +++- tempest/lib/services/compute/hosts_client.py | 18 +++++++++++++++--- .../lib/services/compute/hypervisor_client.py | 4 +++- tempest/lib/services/network/quotas_client.py | 4 +++- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/tempest/hacking/checks.py b/tempest/hacking/checks.py index f4b76e5e9..d1bc14182 100644 --- a/tempest/hacking/checks.py +++ b/tempest/hacking/checks.py @@ -151,7 +151,7 @@ def no_testtools_skip_decorator(logical_line): def _common_service_clients_check(logical_line, physical_line, filename, ignored_list_file=None): - if 'tempest/services/' not in filename: + if not re.match('tempest/(lib/)?services/.*', filename): return False if ignored_list_file is not None: diff --git a/tempest/lib/services/compute/flavors_client.py b/tempest/lib/services/compute/flavors_client.py index 6869f0201..e377c8448 100644 --- a/tempest/lib/services/compute/flavors_client.py +++ b/tempest/lib/services/compute/flavors_client.py @@ -133,7 +133,9 @@ class FlavorsClient(base_compute_client.BaseComputeClient): resp, body) return rest_client.ResponseBody(resp, body) - def unset_flavor_extra_spec(self, flavor_id, key): + def unset_flavor_extra_spec(self, flavor_id, key): # noqa + # NOTE: This noqa is for passing T111 check and we cannot rename + # to keep backwards compatibility. """Unset extra Specs from the mentioned flavor.""" resp, body = self.delete('flavors/%s/os-extra_specs/%s' % (flavor_id, key)) diff --git a/tempest/lib/services/compute/hosts_client.py b/tempest/lib/services/compute/hosts_client.py index 01437651a..16b5edda6 100644 --- a/tempest/lib/services/compute/hosts_client.py +++ b/tempest/lib/services/compute/hosts_client.py @@ -61,7 +61,11 @@ class HostsClient(base_compute_client.BaseComputeClient): self.validate_response(schema.update_host, resp, body) return rest_client.ResponseBody(resp, body) - def startup_host(self, hostname): + def startup_host(self, hostname): # noqa + # NOTE: This noqa is for passing T110 check and we cannot rename + # to keep backwards compatibility. Actually, the root problem + # of this is a wrong API design. GET operation should not change + # resource status, but current API does that. """Startup a host.""" resp, body = self.get("os-hosts/%s/startup" % hostname) @@ -69,7 +73,11 @@ class HostsClient(base_compute_client.BaseComputeClient): self.validate_response(schema.startup_host, resp, body) return rest_client.ResponseBody(resp, body) - def shutdown_host(self, hostname): + def shutdown_host(self, hostname): # noqa + # NOTE: This noqa is for passing T110 check and we cannot rename + # to keep backwards compatibility. Actually, the root problem + # of this is a wrong API design. GET operation should not change + # resource status, but current API does that. """Shutdown a host.""" resp, body = self.get("os-hosts/%s/shutdown" % hostname) @@ -77,7 +85,11 @@ class HostsClient(base_compute_client.BaseComputeClient): self.validate_response(schema.shutdown_host, resp, body) return rest_client.ResponseBody(resp, body) - def reboot_host(self, hostname): + def reboot_host(self, hostname): # noqa + # NOTE: This noqa is for passing T110 check and we cannot rename + # to keep backwards compatibility. Actually, the root problem + # of this is a wrong API design. GET operation should not change + # resource status, but current API does that. """Reboot a host.""" resp, body = self.get("os-hosts/%s/reboot" % hostname) diff --git a/tempest/lib/services/compute/hypervisor_client.py b/tempest/lib/services/compute/hypervisor_client.py index 5dcecc992..23c304e83 100644 --- a/tempest/lib/services/compute/hypervisor_client.py +++ b/tempest/lib/services/compute/hypervisor_client.py @@ -63,7 +63,9 @@ class HypervisorClient(base_compute_client.BaseComputeClient): self.validate_response(schema.get_hypervisor_uptime, resp, body) return rest_client.ResponseBody(resp, body) - def search_hypervisor(self, hypervisor_name): + def search_hypervisor(self, hypervisor_name): # noqa + # NOTE: This noqa is for passing T110 check and we cannot rename + # to keep backwards compatibility. """Search specified hypervisor.""" resp, body = self.get('os-hypervisors/%s/search' % hypervisor_name) body = json.loads(body) diff --git a/tempest/lib/services/network/quotas_client.py b/tempest/lib/services/network/quotas_client.py index b5cf35b95..752b253f4 100644 --- a/tempest/lib/services/network/quotas_client.py +++ b/tempest/lib/services/network/quotas_client.py @@ -22,7 +22,9 @@ class QuotasClient(base.BaseNetworkClient): uri = '/quotas/%s' % tenant_id return self.update_resource(uri, put_body) - def reset_quotas(self, tenant_id): + def reset_quotas(self, tenant_id): # noqa + # NOTE: This noqa is for passing T111 check and we cannot rename + # to keep backwards compatibility. uri = '/quotas/%s' % tenant_id return self.delete_resource(uri)