Merge flavor all_extensions 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 flavor all_extensions functional tests.

Partially implements blueprint test-collapse-v2-and-v21

Change-Id: I1ca95ec4fc11294a8b8d484f54503df14726c2e4
This commit is contained in:
ghanshyam 2015-08-19 16:46:09 +09:00 committed by Ghanshyam Mann
parent b026b1ad13
commit 72e568af11
11 changed files with 168 additions and 135 deletions

View File

@ -1,6 +1,10 @@
{
"flavors": [
{
"OS-FLV-DISABLED:disabled": false,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "1",
"links": [
{
@ -12,9 +16,17 @@
"rel": "bookmark"
}
],
"name": "m1.tiny"
"name": "m1.tiny",
"ram": 512,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 1
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 20,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "2",
"links": [
{
@ -26,9 +38,17 @@
"rel": "bookmark"
}
],
"name": "m1.small"
"name": "m1.small",
"ram": 2048,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 1
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 40,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "3",
"links": [
{
@ -40,9 +60,17 @@
"rel": "bookmark"
}
],
"name": "m1.medium"
"name": "m1.medium",
"ram": 4096,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 2
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 80,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "4",
"links": [
{
@ -54,9 +82,17 @@
"rel": "bookmark"
}
],
"name": "m1.large"
"name": "m1.large",
"ram": 8192,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 4
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 160,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "5",
"links": [
{
@ -68,7 +104,11 @@
"rel": "bookmark"
}
],
"name": "m1.xlarge"
"name": "m1.xlarge",
"ram": 16384,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 8
}
]
}

View File

@ -1,19 +0,0 @@
{
"flavor": {
"disk": 1,
"id": "1",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/1",
"rel": "bookmark"
}
],
"name": "m1.tiny",
"ram": 512,
"vcpus": 1
}
}

View File

@ -1,74 +0,0 @@
{
"flavors": [
{
"id": "1",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/1",
"rel": "bookmark"
}
],
"name": "m1.tiny"
},
{
"id": "2",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/2",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/2",
"rel": "bookmark"
}
],
"name": "m1.small"
},
{
"id": "3",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/3",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/3",
"rel": "bookmark"
}
],
"name": "m1.medium"
},
{
"id": "4",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/4",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/4",
"rel": "bookmark"
}
],
"name": "m1.large"
},
{
"id": "5",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/5",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/5",
"rel": "bookmark"
}
],
"name": "m1.xlarge"
}
]
}

View File

@ -0,0 +1,114 @@
{
"flavors": [
{
"OS-FLV-DISABLED:disabled": false,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 0,
"id": "1",
"links": [
{
"href": "%(host)s/v2/openstack/flavors/1",
"rel": "self"
},
{
"href": "%(host)s/openstack/flavors/1",
"rel": "bookmark"
}
],
"name": "m1.tiny",
"os-flavor-access:is_public": true,
"ram": 512,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 1
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 20,
"OS-FLV-EXT-DATA:ephemeral": 0,
"id": "2",
"links": [
{
"href": "%(host)s/v2/openstack/flavors/2",
"rel": "self"
},
{
"href": "%(host)s/openstack/flavors/2",
"rel": "bookmark"
}
],
"name": "m1.small",
"os-flavor-access:is_public": true,
"ram": 2048,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 1
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 40,
"OS-FLV-EXT-DATA:ephemeral": 0,
"id": "3",
"links": [
{
"href": "%(host)s/v2/openstack/flavors/3",
"rel": "self"
},
{
"href": "%(host)s/openstack/flavors/3",
"rel": "bookmark"
}
],
"name": "m1.medium",
"os-flavor-access:is_public": true,
"ram": 4096,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 2
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 80,
"OS-FLV-EXT-DATA:ephemeral": 0,
"id": "4",
"links": [
{
"href": "%(host)s/v2/openstack/flavors/4",
"rel": "self"
},
{
"href": "%(host)s/openstack/flavors/4",
"rel": "bookmark"
}
],
"name": "m1.large",
"os-flavor-access:is_public": true,
"ram": 8192,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 4
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 160,
"OS-FLV-EXT-DATA:ephemeral": 0,
"id": "5",
"links": [
{
"href": "%(host)s/v2/openstack/flavors/5",
"rel": "self"
},
{
"href": "%(host)s/openstack/flavors/5",
"rel": "bookmark"
}
],
"name": "m1.xlarge",
"os-flavor-access:is_public": true,
"ram": 16384,
"rxtx_factor": 1.0,
"swap": "",
"vcpus": 8
}
]
}

View File

@ -1,19 +0,0 @@
{
"flavor": {
"disk": 1,
"id": "1",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/1",
"rel": "bookmark"
}
],
"name": "m1.tiny",
"ram": 512,
"vcpus": 1
}
}

View File

@ -165,24 +165,6 @@ class ServersSampleBase(ApiSampleTestBaseV2):
self.__class__._use_common_server_api_samples = orig_value
class FlavorsSampleJsonTest(ApiSampleTestBaseV2):
sample_dir = 'flavors'
def test_flavors_get(self):
response = self._do_get('flavors/1')
subs = self._get_regexes()
self._verify_response('flavor-get-resp', subs, response, 200)
def test_flavors_list(self):
response = self._do_get('flavors')
subs = self._get_regexes()
self._verify_response('flavors-list-resp', subs, response, 200)
class FlavorsSampleAllExtensionJsonTest(FlavorsSampleJsonTest):
all_extensions = True
class LimitsSampleJsonTest(ApiSampleTestBaseV2):
sample_dir = 'limits'

View File

@ -56,3 +56,12 @@ class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
response = self._do_get('flavors/detail')
subs = self._get_regexes()
self._verify_response('flavors-detail-resp', subs, response, 200)
class FlavorsSampleAllExtensionJsonTest(FlavorsSampleJsonTest):
all_extensions = True
def _get_flags(self):
f = super(FlavorsSampleJsonTest, self)._get_flags()
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
return f