Check attributes of image meta item Nova APIs
This patch adds the JSON Schema for Nova V2 Image meta item APIs
(set & get meta item) and validate the response with added JSON
Schema to block the backward incompatibility change in the future.
Response body of above APIs is below-
{
"meta":
{
}
}
Partially implements blueprint nova-api-attribute-test
Change-Id: Ic00fc3b4750057b641ef01738e34f7242e27bb1d
diff --git a/tempest/api_schema/compute/v2/images.py b/tempest/api_schema/compute/v2/images.py
index 7fd6b84..fad6b56 100644
--- a/tempest/api_schema/compute/v2/images.py
+++ b/tempest/api_schema/compute/v2/images.py
@@ -109,3 +109,14 @@
'required': ['metadata']
}
}
+
+image_meta_item = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'meta': {'type': 'object'}
+ },
+ 'required': ['meta']
+ }
+}
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
index abf6049..bd39a04 100644
--- a/tempest/services/compute/json/images_client.py
+++ b/tempest/services/compute/json/images_client.py
@@ -117,6 +117,7 @@
"""Returns the value for a specific image metadata key."""
resp, body = self.get("images/%s/metadata/%s" % (str(image_id), key))
body = json.loads(body)
+ self.validate_response(schema.image_meta_item, resp, body)
return resp, body['meta']
def set_image_metadata_item(self, image_id, key, meta):
@@ -125,6 +126,7 @@
resp, body = self.put('images/%s/metadata/%s' % (str(image_id), key),
post_body)
body = json.loads(body)
+ self.validate_response(schema.image_meta_item, resp, body)
return resp, body['meta']
def delete_image_metadata_item(self, image_id, key):