Merge server personality 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 personality functional tests.
Also inherit personality tests from ServersSampleBase to reuse code.

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 run
merged functional tests for both v2 and v2.1.

Note- V2 has no separate personality tests. This was added as separate
plugin in v2.1

Change-Id: I0e61ad236c0168977cad89432490f803eb3a61fd
This commit is contained in:
ghanshyam
2015-04-14 16:11:59 +09:00
committed by Ghanshyam Mann
parent 168cea8031
commit 970fcf7cfa
7 changed files with 31 additions and 26 deletions

View File

@@ -1,5 +1,7 @@
{
"rebuild": {
"accessIPv4" : "1.2.3.4",
"accessIPv6" : "80fe::",
"imageRef": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
"name": "new-server-test",
"metadata": {

View File

@@ -1,5 +1,7 @@
{
"server": {
"accessIPv4" : "1.2.3.4",
"accessIPv6" : "80fe::",
"addresses": {
"private": [
{
@@ -14,7 +16,7 @@
"id": "1",
"links": [
{
"href": "http://openstack.example.com/flavors/1",
"href": "http://openstack.example.com/openstack/flavors/1",
"rel": "bookmark"
}
]
@@ -25,18 +27,18 @@
"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"
}
]
},
"links": [
{
"href": "http://openstack.example.com/v3/servers/53a63a19-c145-47f8-9ae5-b39d6bff33ec",
"href": "http://openstack.example.com/v2/openstack/servers/53a63a19-c145-47f8-9ae5-b39d6bff33ec",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/53a63a19-c145-47f8-9ae5-b39d6bff33ec",
"href": "http://openstack.example.com/openstack/servers/53a63a19-c145-47f8-9ae5-b39d6bff33ec",
"rel": "bookmark"
}
],

View File

@@ -4,11 +4,11 @@
"id": "934760e1-2b0b-4f9e-a916-eac1e69839dc",
"links": [
{
"href": "http://openstack.example.com/v3/servers/934760e1-2b0b-4f9e-a916-eac1e69839dc",
"href": "http://openstack.example.com/v2/openstack/servers/934760e1-2b0b-4f9e-a916-eac1e69839dc",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/934760e1-2b0b-4f9e-a916-eac1e69839dc",
"href": "http://openstack.example.com/openstack/servers/934760e1-2b0b-4f9e-a916-eac1e69839dc",
"rel": "bookmark"
}
]

View File

@@ -1,5 +1,7 @@
{
"rebuild": {
"accessIPv4" : "%(access_ip_v4)s",
"accessIPv6" : "%(access_ip_v6)s",
"imageRef": "%(glance_host)s/images/%(image_id)s",
"name": "new-server-test",
"metadata": {

View File

@@ -1,5 +1,7 @@
{
"server": {
"accessIPv4": "%(access_ip_v4)s",
"accessIPv6": "%(access_ip_v6)s",
"addresses": {
"private": [
{
@@ -14,7 +16,7 @@
"id": "1",
"links": [
{
"href": "%(host)s/flavors/1",
"href": "%(host)s/openstack/flavors/1",
"rel": "bookmark"
}
]
@@ -25,18 +27,18 @@
"id": "%(image_id)s",
"links": [
{
"href": "%(host)s/images/%(image_id)s",
"href": "%(host)s/openstack/images/%(image_id)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"
}
],

View File

@@ -4,11 +4,11 @@
"id": "%(id)s",
"links": [
{
"href": "http://openstack.example.com/v3/servers/%(uuid)s",
"href": "http://openstack.example.com/v2/openstack/servers/%(uuid)s",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/%(uuid)s",
"href": "http://openstack.example.com/openstack/servers/%(uuid)s",
"rel": "bookmark"
}
]

View File

@@ -12,34 +12,31 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova.tests.functional.v3 import api_sample_base
from nova.tests.functional.v3 import test_servers
from nova.tests.unit.image import fake
class PersonalitySampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
class PersonalitySampleJsonTest(test_servers.ServersSampleBase):
extension_name = 'os-personality'
def _servers_post(self, subs):
response = self._do_post('servers', 'server-post-req', subs)
subs.update(self._get_regexes())
return self._verify_response('server-post-resp', subs, response, 202)
extra_extensions_to_load = ["os-access-ips"]
_api_version = 'v2'
def test_servers_post(self):
subs = {
'image_id': fake.get_valid_image_id(),
'host': self._get_host()
}
self._servers_post(subs)
self._post_server(use_common_server_api_samples=False)
def test_servers_rebuild(self):
subs = {
'image_id': fake.get_valid_image_id(),
'host': self._get_host()
'host': self._get_host(),
'glance_host': self._get_glance_host(),
'access_ip_v4': '1.2.3.4',
'access_ip_v6': '80fe::'
}
uuid = self._servers_post(subs)
uuid = self._post_server(use_common_server_api_samples=False)
response = self._do_post('servers/%s/action' % uuid,
'server-action-rebuild-req', subs)
subs['hostid'] = '[a-f0-9]+'
subs['id'] = uuid
subs.update(self._get_regexes())
self._verify_response('server-action-rebuild-resp',
subs, response, 202)