From d110ec59615d24e4a6528d41c0f3f73b7f93aa05 Mon Sep 17 00:00:00 2001 From: Kevin_Zheng Date: Thu, 14 Dec 2017 14:50:56 +0800 Subject: [PATCH] Updated common create server sample request because of microversion 2.57 Change Ia89eeb6725459c35369e8f790f68ad9180bd3aba added new microversion 2.57. This microversion removed field 'personality' from create server request. By default Nova functional api tests use samples from '/servers' directory to create a server. But now such requests got 400 Bad Request because of additional 'personality' field. We must handle this case if we are testing microversions >= 2.57. This patch will add sample for microversion 2.57+ Change-Id: I8c4e8ffc00ab53f07e7364767f4480abebd2e357 --- .../servers/server-create-req-v257.json | 21 +++++++++++++++++++ .../servers/server-create-req-v257.json.tpl | 21 +++++++++++++++++++ .../api_sample_tests/test_servers.py | 3 ++- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 doc/api_samples/servers/server-create-req-v257.json create mode 100644 nova/tests/functional/api_sample_tests/api_samples/servers/server-create-req-v257.json.tpl diff --git a/doc/api_samples/servers/server-create-req-v257.json b/doc/api_samples/servers/server-create-req-v257.json new file mode 100644 index 000000000000..c6d8dec24244 --- /dev/null +++ b/doc/api_samples/servers/server-create-req-v257.json @@ -0,0 +1,21 @@ +{ + "server" : { + "accessIPv4": "1.2.3.4", + "accessIPv6": "80fe::", + "name" : "new-server-test", + "imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b", + "flavorRef" : "http://openstack.example.com/flavors/1", + "availability_zone": "nova", + "OS-DCF:diskConfig": "AUTO", + "metadata" : { + "My Server Name" : "Apache1" + }, + "security_groups": [ + { + "name": "default" + } + ], + "user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==", + "networks": "auto" + } +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/servers/server-create-req-v257.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/servers/server-create-req-v257.json.tpl new file mode 100644 index 000000000000..14898309f1ba --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/servers/server-create-req-v257.json.tpl @@ -0,0 +1,21 @@ +{ + "server" : { + "accessIPv4": "%(access_ip_v4)s", + "accessIPv6": "%(access_ip_v6)s", + "name" : "%(name)s", + "imageRef" : "%(image_id)s", + "flavorRef" : "http://openstack.example.com/flavors/1", + "availability_zone": "nova", + "OS-DCF:diskConfig": "AUTO", + "metadata" : { + "My Server Name" : "Apache1" + }, + "security_groups": [ + { + "name": "default" + } + ], + "user_data" : "%(user_data)s", + "networks": "auto" + } +} diff --git a/nova/tests/functional/api_sample_tests/test_servers.py b/nova/tests/functional/api_sample_tests/test_servers.py index b34cfc9061e0..2d6882642ae4 100644 --- a/nova/tests/functional/api_sample_tests/test_servers.py +++ b/nova/tests/functional/api_sample_tests/test_servers.py @@ -33,7 +33,8 @@ class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21): common_req_names = [ (None, '2.36', 'server-create-req'), - ('2.37', None, 'server-create-req-v237') + ('2.37', '2.56', 'server-create-req-v237'), + ('2.57', None, 'server-create-req-v257') ] def _get_request_name(self, use_common):