Merge server usage tests between 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 servers usage functional tests. In V2.1 os-access-ip is separate plugin where in v2 it was mixed in server plugin itself. So os-access-ip extension is enabled to run merged functional tests for both v2 and v2.1. Change-Id: I46bfeaed8f47ea7674f14d6f3d3b301dcc35d419
This commit is contained in:
parent
45c4fcb095
commit
bb00d795c6
@ -1,56 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-SRV-USG:launched_at": "2013-05-02T19:26:38.326387",
|
||||
"OS-SRV-USG:terminated_at": null,
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "192.168.0.3",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"created": "2013-05-02T19:26:37Z",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "1127931217d16e2c8b1e1ec54de06f17805bfaadc0d36525879450d1",
|
||||
"id": "cbdfb561-b94b-4b98-bb22-7d62575114b1",
|
||||
"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/cbdfb561-b94b-4b98-bb22-7d62575114b1",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/cbdfb561-b94b-4b98-bb22-7d62575114b1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2013-05-02T19:26:38Z",
|
||||
"user_id": "fake"
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"OS-SRV-USG:launched_at": "2013-05-02T19:26:45.066375",
|
||||
"OS-SRV-USG:terminated_at": null,
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "192.168.0.3",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"created": "2013-05-02T19:26:44Z",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "15ac731a430372d42a333d9d316ff2af70e0bf5eee523a0bc43779f5",
|
||||
"id": "fe828a86-aad7-464b-8995-280bedf4fa9b",
|
||||
"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/fe828a86-aad7-464b-8995-280bedf4fa9b",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/fe828a86-aad7-464b-8995-280bedf4fa9b",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"progress": 0,
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2013-05-02T19:26:45Z",
|
||||
"user_id": "fake"
|
||||
}
|
||||
]
|
||||
}
|
@ -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/cee6d136-e378-4cfc-9eec-71797f025991",
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/cee6d136-e378-4cfc-9eec-71797f025991",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/cee6d136-e378-4cfc-9eec-71797f025991",
|
||||
"href": "http://openstack.example.com/openstack/servers/cee6d136-e378-4cfc-9eec-71797f025991",
|
||||
"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/ae114799-9164-48f5-a036-6ef9310acbc4",
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/ae114799-9164-48f5-a036-6ef9310acbc4",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/ae114799-9164-48f5-a036-6ef9310acbc4",
|
||||
"href": "http://openstack.example.com/openstack/servers/ae114799-9164-48f5-a036-6ef9310acbc4",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
|
@ -1,56 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-SRV-USG:launched_at": "%(strtime)s",
|
||||
"OS-SRV-USG:terminated_at": null,
|
||||
"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/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/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,57 +0,0 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"status": "ACTIVE",
|
||||
"updated": "%(isotime)s",
|
||||
"OS-SRV-USG:launched_at": "%(strtime)s",
|
||||
"user_id": "fake",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "%(ip)s",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(uuid)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": "",
|
||||
"OS-SRV-USG:terminated_at": null,
|
||||
"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"
|
||||
}
|
||||
}]
|
||||
}
|
@ -1455,26 +1455,6 @@ class ExtendedVolumesSampleJsonTests(ServersSampleBase):
|
||||
self._verify_response('servers-detail-resp', subs, response, 200)
|
||||
|
||||
|
||||
class ServerUsageSampleJsonTests(ServersSampleBase):
|
||||
extension_name = ("nova.api.openstack.compute.contrib"
|
||||
".server_usage.Server_usage")
|
||||
|
||||
def test_show(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_get('servers/%s' % uuid)
|
||||
subs = self._get_regexes()
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
return self._verify_response('server-get-resp', subs, response, 200)
|
||||
|
||||
def test_detail(self):
|
||||
self._post_server()
|
||||
response = self._do_get('servers/detail')
|
||||
subs = self._get_regexes()
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
return 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",
|
||||
"OS-SRV-USG:launched_at": "%(strtime)s",
|
||||
"OS-SRV-USG:terminated_at": null,
|
||||
"addresses": {
|
||||
@ -17,7 +19,7 @@
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/flavors/1",
|
||||
"href": "%(host)s/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
@ -28,7 +30,7 @@
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/images/%(uuid)s",
|
||||
"href": "%(host)s/openstack/images/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
@ -36,11 +38,11 @@
|
||||
"key_name": null,
|
||||
"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"
|
||||
}
|
||||
],
|
||||
|
@ -1,6 +1,8 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"accessIPv4": "%(access_ip_v4)s",
|
||||
"accessIPv6": "%(access_ip_v6)s",
|
||||
"status": "ACTIVE",
|
||||
"created": "%(isotime)s",
|
||||
"OS-SRV-USG:launched_at": "%(strtime)s",
|
||||
@ -18,11 +20,11 @@
|
||||
"key_name": null,
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/servers/%(uuid)s",
|
||||
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/servers/%(id)s",
|
||||
"href": "%(host)s/openstack/servers/%(id)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
@ -32,7 +34,7 @@
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/images/%(uuid)s",
|
||||
"href": "%(host)s/openstack/images/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
@ -45,7 +47,7 @@
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/flavors/1",
|
||||
"href": "%(host)s/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
|
@ -13,11 +13,33 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from nova.tests.functional.v3 import test_servers
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('osapi_compute_extension',
|
||||
'nova.api.openstack.compute.extensions')
|
||||
|
||||
|
||||
class ServerUsageSampleJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = 'os-server-usage'
|
||||
extra_extensions_to_load = ["os-access-ips"]
|
||||
_api_version = 'v2'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServerUsageSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.server_usage.Server_usage')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp method for server usage."""
|
||||
@ -29,6 +51,8 @@ class ServerUsageSampleJsonTest(test_servers.ServersSampleBase):
|
||||
subs = self._get_regexes()
|
||||
subs['id'] = self.uuid
|
||||
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_details(self):
|
||||
@ -36,4 +60,6 @@ class ServerUsageSampleJsonTest(test_servers.ServersSampleBase):
|
||||
subs = self._get_regexes()
|
||||
subs['id'] = self.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
Block a user