Adds test_update_all_metadata_field_not_included negative test
Adds test_update_all_metadata_field_not_included negative test
which checks a BadRequest is returned when attempting to
set the server metadata and not include the metadata field
Collapses all of the negative tests into one testcase as they
should not have any side effects and it will slightly reduce
setup overhead.
Change-Id: Iab221d23e896fb22bbe351bb20c0378ebaa60add
Closes-Bug: 1131536
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 990c986..851041b 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -236,8 +236,11 @@
body = json.loads(body)
return resp, body['metadata']
- def set_server_metadata(self, server_id, meta):
- post_body = json.dumps({'metadata': meta})
+ def set_server_metadata(self, server_id, meta, no_metadata_field=False):
+ if no_metadata_field:
+ post_body = ""
+ else:
+ post_body = json.dumps({'metadata': meta})
resp, body = self.put('servers/%s/metadata' % str(server_id),
post_body, self.headers)
body = json.loads(body)