Enable all extension for server PUT API sample tests
As extensions options has been deprecated, API sample tests should run against all extension enable. This commit enables all extensions for server PUT API tests and remove its specific extensions tests and sample files. Adding a hack for other tests which are still running with specific extensions. That is needed to avoid all tests updates in single commit. Partially implements blueprint api-sample-tests-with-all-extensions Change-Id: I9c44da3d9df39c1db0948194502be52f4f15acf2
This commit is contained in:
parent
1dfec71862
commit
42e4126f05
@ -1,6 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"accessIPv4": "4.3.2.1",
|
||||
"accessIPv6": "80fe::"
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "192.168.0.3",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"created": "2013-11-06T08:11:57Z",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "ea0fd522e5bc2fea872429b331304a6f930f2d9aa2a5dc95b3c6061a",
|
||||
"id": "fea9595c-ce6e-4565-987e-2d301fe056ac",
|
||||
"image": {
|
||||
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/fea9595c-ce6e-4565-987e-2d301fe056ac",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/fea9595c-ce6e-4565-987e-2d301fe056ac",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"accessIPv4": "4.3.2.1",
|
||||
"accessIPv6": "80fe::",
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2013-11-06T08:11:58Z",
|
||||
"user_id": "fake"
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-DCF:diskConfig": "AUTO"
|
||||
}
|
||||
}
|
12
doc/api_samples/servers/server-create-req.json
Normal file
12
doc/api_samples/servers/server-create-req.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"server" : {
|
||||
"accessIPv4": "1.2.3.4",
|
||||
"accessIPv6": "80fe::",
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "1",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
}
|
||||
}
|
||||
}
|
22
doc/api_samples/servers/server-create-resp.json
Normal file
22
doc/api_samples/servers/server-create-resp.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"adminPass": "6NpUwoz2QDRN",
|
||||
"id": "f5dc173b-6804-445a-a6d8-c705dad5b5eb",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/f5dc173b-6804-445a-a6d8-c705dad5b5eb",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/f5dc173b-6804-445a-a6d8-c705dad5b5eb",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"security_groups": [
|
||||
{
|
||||
"name": "default"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
8
doc/api_samples/servers/server-update-req.json
Normal file
8
doc/api_samples/servers/server-update-req.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"server": {
|
||||
"accessIPv4": "4.3.2.1",
|
||||
"accessIPv6": "80fe::",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"name" : "new-server-test"
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"accessIPv4": "1.2.3.4",
|
||||
"accessIPv6": "80fe::",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"accessIPv4": "%(access_ip_v4)s",
|
||||
"accessIPv6": "%(access_ip_v6)s"
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"accessIPv4": "%(access_ip_v4)s",
|
||||
"accessIPv6": "%(access_ip_v6)s",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "%(ip)s",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"created": "%(isotime)s",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(compute_endpoint)s/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "%(hostid)s",
|
||||
"id": "%(id)s",
|
||||
"image": {
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(compute_endpoint)s/images/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "%(versioned_compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "%(isotime)s",
|
||||
"user_id": "fake"
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-DCF:diskConfig": "AUTO"
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"server" : {
|
||||
"accessIPv4": "%(access_ip_v4)s",
|
||||
"accessIPv6": "%(access_ip_v6)s",
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "1",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"adminPass": "%(password)s",
|
||||
"id": "%(id)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(versioned_compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"security_groups": [
|
||||
{
|
||||
"name": "default"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"server": {
|
||||
"accessIPv4": "%(access_ip_v4)s",
|
||||
"accessIPv6": "%(access_ip_v6)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"name" : "new-server-test"
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"accessIPv4": "%(access_ip_v4)s",
|
||||
"accessIPv6": "%(access_ip_v6)s",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
@ -93,18 +93,3 @@ class AccessIPsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
subs['id'] = uuid
|
||||
self._verify_response('server-action-rebuild-resp',
|
||||
subs, response, 202)
|
||||
|
||||
def test_servers_update(self):
|
||||
subs = {
|
||||
'image_id': fake.get_valid_image_id(),
|
||||
'compute_endpoint': self._get_compute_endpoint(),
|
||||
'access_ip_v4': '1.2.3.4',
|
||||
'access_ip_v6': 'fe80::'
|
||||
}
|
||||
uuid = self._servers_post(subs)
|
||||
subs['access_ip_v4'] = "4.3.2.1"
|
||||
subs['access_ip_v6'] = '80fe::'
|
||||
response = self._do_put('servers/%s' % uuid, 'server-put-req', subs)
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
subs['id'] = uuid
|
||||
self._verify_response('server-put-resp', subs, response, 200)
|
||||
|
@ -61,16 +61,6 @@ class DiskConfigJsonTest(test_servers.ServersSampleBase):
|
||||
subs['access_ip_v6'] = ''
|
||||
self._verify_response('server-get-resp', subs, response, 200)
|
||||
|
||||
def test_update_server(self):
|
||||
uuid = self._post_server(use_common_server_api_samples=False)
|
||||
response = self._do_put('servers/%s' % uuid,
|
||||
'server-update-put-req', {})
|
||||
subs = {}
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
subs['access_ip_v4'] = ''
|
||||
subs['access_ip_v6'] = ''
|
||||
self._verify_response('server-update-put-resp', subs, response, 200)
|
||||
|
||||
def test_resize_server(self):
|
||||
self.flags(allow_resize_to_same_host=True)
|
||||
uuid = self._post_server(use_common_server_api_samples=False)
|
||||
|
@ -42,13 +42,22 @@ class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21):
|
||||
'access_ip_v4': '1.2.3.4',
|
||||
'access_ip_v6': '80fe::'
|
||||
}
|
||||
# TODO(gmann): Remove this hack once all tests using this common
|
||||
# _post_server method are enabled with all extension.
|
||||
# This is added to avoid all tests updates together.
|
||||
post_req_template = 'server-post-req'
|
||||
post_resp_template = 'server-post-resp'
|
||||
if self.all_extensions and use_common_server_api_samples:
|
||||
post_req_template = 'server-create-req'
|
||||
post_resp_template = 'server-create-resp'
|
||||
|
||||
orig_value = self.__class__._use_common_server_api_samples
|
||||
orig_sample_dir = self.__class__.sample_dir
|
||||
try:
|
||||
self.__class__._use_common_server_api_samples = (
|
||||
use_common_server_api_samples)
|
||||
response = self._do_post('servers', 'server-post-req', subs)
|
||||
status = self._verify_response('server-post-resp', subs,
|
||||
response = self._do_post('servers', post_req_template, subs)
|
||||
status = self._verify_response(post_resp_template, subs,
|
||||
response, 202)
|
||||
return status
|
||||
finally:
|
||||
@ -138,6 +147,24 @@ class ServersSampleJson219Test(ServersSampleJsonTest):
|
||||
self._verify_response('server-put-resp', subs, response, 200)
|
||||
|
||||
|
||||
class ServersUpdateSampleJsonTest(ServersSampleBase):
|
||||
sample_dir = 'servers'
|
||||
|
||||
# TODO(gmann): This will be removed once all API tests runs for
|
||||
# all extension enable.
|
||||
all_extensions = True
|
||||
|
||||
def test_update_server(self):
|
||||
uuid = self._post_server()
|
||||
subs = {}
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
subs['access_ip_v4'] = '1.2.3.4'
|
||||
subs['access_ip_v6'] = '80fe::'
|
||||
response = self._do_put('servers/%s' % uuid,
|
||||
'server-update-req', subs)
|
||||
self._verify_response('server-update-resp', subs, response, 200)
|
||||
|
||||
|
||||
class ServerSortKeysJsonTests(ServersSampleBase):
|
||||
sample_dir = 'servers-sort'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user