Verify 'list-server-metadata' APIs attributes
This patch verifies the response attributes of 'list-server-metadata'.
The response attributes of v2 and v3 are the same:
{
"metadata": {
"foo": "Foo Value"
}
}
Partially implements blueprint nova-api-attribute-test
Change-Id: Iab1cb1efc0293e8e0aa5124752ec95048b8608bf
diff --git a/tempest/api_schema/compute/servers.py b/tempest/api_schema/compute/servers.py
index b27fb5e..31cd56b 100644
--- a/tempest/api_schema/compute/servers.py
+++ b/tempest/api_schema/compute/servers.py
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import copy
+
get_password = {
'status_code': [200],
'response_body': {
@@ -58,3 +60,5 @@
'required': ['metadata']
}
}
+
+list_server_metadata = copy.deepcopy(set_server_metadata)
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 190b831..82ded4c 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -276,6 +276,7 @@
def list_server_metadata(self, server_id):
resp, body = self.get("servers/%s/metadata" % str(server_id))
body = json.loads(body)
+ self.validate_response(common_schema.list_server_metadata, resp, body)
return resp, body['metadata']
def set_server_metadata(self, server_id, meta, no_metadata_field=False):
diff --git a/tempest/services/compute/v3/json/servers_client.py b/tempest/services/compute/v3/json/servers_client.py
index 7d21ed3..67232a8 100644
--- a/tempest/services/compute/v3/json/servers_client.py
+++ b/tempest/services/compute/v3/json/servers_client.py
@@ -284,6 +284,7 @@
def list_server_metadata(self, server_id):
resp, body = self.get("servers/%s/metadata" % str(server_id))
body = json.loads(body)
+ self.validate_response(common_schema.list_server_metadata, resp, body)
return resp, body['metadata']
def set_server_metadata(self, server_id, meta, no_metadata_field=False):