Check list & search hypervisor attributes of Nova
This patch adds the JSON Schema for response of Nova V2 & V3
list & search hypervisor APIs and validate the response with added
JSON Schema to block the backward incompatibility change in the future.
The response body of V2 & V3 list & search hypervisor API is same
& given below:
{
"hypervisors": [
{
"id": 1,
"hypervisor_hostname": "fake-mini",
}
]
}
Partially implements blueprint nova-api-attribute-test
Change-Id: I3929794061e0709561f905cd053249d36afb0a82
diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py
index 28ca2a6..83ff984 100644
--- a/tempest/services/compute/json/hypervisor_client.py
+++ b/tempest/services/compute/json/hypervisor_client.py
@@ -33,6 +33,8 @@
"""List hypervisors information."""
resp, body = self.get('os-hypervisors')
body = json.loads(body)
+ self.validate_response(common_schema.common_hypervisors_detail,
+ resp, body)
return resp, body['hypervisors']
def get_hypervisor_list_details(self):
@@ -75,4 +77,6 @@
"""Search specified hypervisor."""
resp, body = self.get('os-hypervisors/%s/search' % hyper_name)
body = json.loads(body)
+ self.validate_response(common_schema.common_hypervisors_detail,
+ resp, body)
return resp, body['hypervisors']
diff --git a/tempest/services/compute/v3/json/hypervisor_client.py b/tempest/services/compute/v3/json/hypervisor_client.py
index abe6788..a572d55 100644
--- a/tempest/services/compute/v3/json/hypervisor_client.py
+++ b/tempest/services/compute/v3/json/hypervisor_client.py
@@ -33,6 +33,8 @@
"""List hypervisors information."""
resp, body = self.get('os-hypervisors')
body = json.loads(body)
+ self.validate_response(common_schema.common_hypervisors_detail,
+ resp, body)
return resp, body['hypervisors']
def get_hypervisor_list_details(self):
@@ -73,4 +75,6 @@
"""Search specified hypervisor."""
resp, body = self.get('os-hypervisors/search?query=%s' % hyper_name)
body = json.loads(body)
+ self.validate_response(common_schema.common_hypervisors_detail,
+ resp, body)
return resp, body['hypervisors']