Merge extended-volume functional tests of v2 and v2.1
Currently v2 and v2.1 have separate functional tests and their corresponding sample files. As v2 and v2.1 are supposed to be identical, there is overhead to maintain two set of functional tests and sample files. We can have one set of tests which can run for both v2 and v2.1. This commit merges extended-volume functional tests. Change-Id: I18f3c9f3e3b253006b1a34b4739716aa21275d66
This commit is contained in:
parent
5a1a1b7b71
commit
f036a54801
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
"server": {
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "192.168.0.3",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"created": "2013-02-07T19:35:09Z",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "570eff4776ab310707d11d181037337197086998a8b3305c90bf87c8",
|
||||
"id": "ecb5e433-fa75-4db2-af3d-a29ae8618edc",
|
||||
"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/ecb5e433-fa75-4db2-af3d-a29ae8618edc",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/ecb5e433-fa75-4db2-af3d-a29ae8618edc",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2013-02-07T19:35:10Z",
|
||||
"user_id": "fake",
|
||||
"os-extended-volumes:volumes_attached": [
|
||||
{"id": "volume_id1"},
|
||||
{"id": "volume_id2"}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
{
|
||||
"servers": [
|
||||
{
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "192.168.0.3",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"created": "2012-12-05T07:34:10Z",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "585aa01f94eca692eff9f77ffe3eab866d8a819e97397e28c5c7df12",
|
||||
"id": "030758aa-5c41-41c6-8fb4-29d44eb96a85",
|
||||
"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/030758aa-5c41-41c6-8fb4-29d44eb96a85",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/030758aa-5c41-41c6-8fb4-29d44eb96a85",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2012-12-05T07:34:10Z",
|
||||
"user_id": "fake",
|
||||
"os-extended-volumes:volumes_attached": [
|
||||
{"id": "volume_id1"},
|
||||
{"id": "volume_id2"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"server": {
|
||||
"accessIPv4": "1.2.3.4",
|
||||
"accessIPv6": "80fe::",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
|
@ -15,7 +17,7 @@
|
|||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/flavors/1",
|
||||
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
|
@ -26,7 +28,7 @@
|
|||
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"href": "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
|
@ -34,11 +36,11 @@
|
|||
"key_name": null,
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v3/servers/7d62983e-23df-4320-bc89-bbc77f2a2e40",
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/7d62983e-23df-4320-bc89-bbc77f2a2e40",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/7d62983e-23df-4320-bc89-bbc77f2a2e40",
|
||||
"href": "http://openstack.example.com/openstack/servers/7d62983e-23df-4320-bc89-bbc77f2a2e40",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"servers": [
|
||||
{
|
||||
"accessIPv4": "1.2.3.4",
|
||||
"accessIPv6": "80fe::",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
|
@ -16,7 +18,7 @@
|
|||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/flavors/1",
|
||||
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
|
@ -27,7 +29,7 @@
|
|||
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"href": "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
|
@ -35,11 +37,11 @@
|
|||
"key_name": null,
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v3/servers/8e479732-7701-48cd-af7a-04d84f51b742",
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/8e479732-7701-48cd-af7a-04d84f51b742",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/8e479732-7701-48cd-af7a-04d84f51b742",
|
||||
"href": "http://openstack.example.com/openstack/servers/8e479732-7701-48cd-af7a-04d84f51b742",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
"key_name": null,
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v3/servers/7d62983e-23df-4320-bc89-bbc77f2a2e40",
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/7d62983e-23df-4320-bc89-bbc77f2a2e40",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/7d62983e-23df-4320-bc89-bbc77f2a2e40",
|
||||
"href": "http://openstack.example.com/openstack/servers/7d62983e-23df-4320-bc89-bbc77f2a2e40",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -35,11 +35,11 @@
|
|||
"key_name": null,
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v3/servers/8e479732-7701-48cd-af7a-04d84f51b742",
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/8e479732-7701-48cd-af7a-04d84f51b742",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/8e479732-7701-48cd-af7a-04d84f51b742",
|
||||
"href": "http://openstack.example.com/openstack/servers/8e479732-7701-48cd-af7a-04d84f51b742",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
"server": {
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "%(ip)s",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"created": "%(isotime)s",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "%(hostid)s",
|
||||
"id": "%(id)s",
|
||||
"image": {
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/openstack/images/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(id)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",
|
||||
"os-extended-volumes:volumes_attached": [
|
||||
{"id": "volume_id1"},
|
||||
{"id": "volume_id2"}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
{
|
||||
"servers": [
|
||||
{
|
||||
"status": "ACTIVE",
|
||||
"updated": "%(isotime)s",
|
||||
"user_id": "fake",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "%(ip)s",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(id)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"created": "%(isotime)s",
|
||||
"name": "new-server-test",
|
||||
"image": {
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/openstack/images/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": "%(uuid)s",
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"tenant_id": "openstack",
|
||||
"progress": 0,
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "%(hostid)s",
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"os-extended-volumes:volumes_attached": [
|
||||
{"id": "volume_id1"},
|
||||
{"id": "volume_id2"}
|
||||
]
|
||||
}]
|
||||
}
|
|
@ -37,7 +37,6 @@ from nova.cloudpipe import pipelib
|
|||
from nova.compute import api as compute_api
|
||||
from nova.compute import cells_api as cells_api
|
||||
from nova.console import manager as console_manager # noqa - only for cfg
|
||||
from nova import db
|
||||
from nova.network import api as network_api
|
||||
from nova.network.neutronv2 import api as neutron_api # noqa - only for cfg
|
||||
from nova import objects
|
||||
|
@ -862,30 +861,6 @@ class ExtendedIpsMacSampleJsonTests(ServersSampleBase):
|
|||
self._verify_response('servers-detail-resp', subs, response, 200)
|
||||
|
||||
|
||||
class ExtendedVolumesSampleJsonTests(ServersSampleBase):
|
||||
extension_name = ("nova.api.openstack.compute.contrib"
|
||||
".extended_volumes.Extended_volumes")
|
||||
|
||||
def test_show(self):
|
||||
uuid = self._post_server()
|
||||
self.stubs.Set(db, 'block_device_mapping_get_all_by_instance',
|
||||
fakes.stub_bdm_get_all_by_instance)
|
||||
response = self._do_get('servers/%s' % uuid)
|
||||
subs = self._get_regexes()
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
self._verify_response('server-get-resp', subs, response, 200)
|
||||
|
||||
def test_detail(self):
|
||||
uuid = self._post_server()
|
||||
self.stubs.Set(db, 'block_device_mapping_get_all_by_instance',
|
||||
fakes.stub_bdm_get_all_by_instance)
|
||||
response = self._do_get('servers/detail')
|
||||
subs = self._get_regexes()
|
||||
subs['id'] = uuid
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
self._verify_response('servers-detail-resp', subs, response, 200)
|
||||
|
||||
|
||||
class ExtendedVIFNetSampleJsonTests(ServersSampleBase):
|
||||
extension_name = ("nova.api.openstack.compute.contrib"
|
||||
".extended_virtual_interfaces_net.Extended_virtual_interfaces_net")
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"server": {
|
||||
"accessIPv4": "%(access_ip_v4)s",
|
||||
"accessIPv6": "%(access_ip_v6)s",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
|
@ -15,7 +17,7 @@
|
|||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/flavors/1",
|
||||
"href": "%(host)s/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
|
@ -26,18 +28,18 @@
|
|||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/images/%(uuid)s",
|
||||
"href": "%(host)s/openstack/images/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/servers/%(uuid)s",
|
||||
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/servers/%(uuid)s",
|
||||
"href": "%(host)s/openstack/servers/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
{
|
||||
"updated": "%(isotime)s",
|
||||
"created": "%(isotime)s",
|
||||
"accessIPv4": "%(access_ip_v4)s",
|
||||
"accessIPv6": "%(access_ip_v6)s",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
|
@ -17,7 +19,7 @@
|
|||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/flavors/1",
|
||||
"href": "%(host)s/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
|
@ -28,18 +30,18 @@
|
|||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/images/%(uuid)s",
|
||||
"href": "%(host)s/openstack/images/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/servers/%(id)s",
|
||||
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/servers/%(id)s",
|
||||
"href": "%(host)s/openstack/servers/%(id)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from nova.compute import api as compute_api
|
||||
from nova import db
|
||||
from nova.tests.functional.v3 import test_servers
|
||||
|
@ -20,9 +22,35 @@ from nova.tests.unit.api.openstack import fakes
|
|||
from nova.tests.unit import fake_block_device
|
||||
from nova.tests.unit import fake_instance
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('osapi_compute_extension',
|
||||
'nova.api.openstack.compute.extensions')
|
||||
|
||||
|
||||
class ExtendedVolumesSampleJsonTests(test_servers.ServersSampleBase):
|
||||
extension_name = "os-extended-volumes"
|
||||
extra_extensions_to_load = ["os-access-ips"]
|
||||
# TODO(park): Overriding '_api_version' till all functional tests
|
||||
# are merged between v2 and v2.1. After that base class variable
|
||||
# itself can be changed to 'v2'
|
||||
_api_version = 'v2'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ExtendedVolumesSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_volumes.'
|
||||
'Extended_volumes')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.'
|
||||
'Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.'
|
||||
'Extended_ips')
|
||||
return f
|
||||
|
||||
def _stub_compute_api_get_instance_bdms(self, server_id):
|
||||
|
||||
|
@ -61,6 +89,8 @@ class ExtendedVolumesSampleJsonTests(test_servers.ServersSampleBase):
|
|||
response = self._do_get('servers/%s' % uuid)
|
||||
subs = self._get_regexes()
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
subs['access_ip_v4'] = '1.2.3.4'
|
||||
subs['access_ip_v6'] = '80fe::'
|
||||
self._verify_response('server-get-resp', subs, response, 200)
|
||||
|
||||
def test_detail(self):
|
||||
|
@ -71,4 +101,6 @@ class ExtendedVolumesSampleJsonTests(test_servers.ServersSampleBase):
|
|||
subs = self._get_regexes()
|
||||
subs['id'] = uuid
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
subs['access_ip_v4'] = '1.2.3.4'
|
||||
subs['access_ip_v6'] = '80fe::'
|
||||
self._verify_response('servers-detail-resp', subs, response, 200)
|
||||
|
|
Loading…
Reference in New Issue