Merge "Merge availability_zone tests between v2 and v2.1"

This commit is contained in:
Jenkins 2015-07-14 13:55:27 +00:00 committed by Gerrit Code Review
commit 8bf7a0070c
17 changed files with 69 additions and 342 deletions

View File

@ -1,55 +0,0 @@
{
"server": {
"OS-EXT-AZ:availability_zone": "nova",
"accessIPv4": "",
"accessIPv6": "",
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"version": 4
}
]
},
"created": "2013-01-30T13:38:47Z",
"flavor": {
"id": "1",
"links": [
{
"href": "http://openstack.example.com/openstack/flavors/1",
"rel": "bookmark"
}
]
},
"hostId": "d38ea49a033b0efaf80c165de63f4805c886dfb94dc0fe731227eccb",
"id": "fb7babfd-e1a1-4add-90e6-3558180983c7",
"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/fb7babfd-e1a1-4add-90e6-3558180983c7",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/servers/fb7babfd-e1a1-4add-90e6-3558180983c7",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "2013-01-30T13:38:49Z",
"user_id": "fake"
}
}

View File

@ -1,57 +0,0 @@
{
"servers": [
{
"OS-EXT-AZ:availability_zone": "nova",
"accessIPv4": "",
"accessIPv6": "",
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"version": 4
}
]
},
"created": "2013-01-30T13:26:51Z",
"flavor": {
"id": "1",
"links": [
{
"href": "http://openstack.example.com/openstack/flavors/1",
"rel": "bookmark"
}
]
},
"hostId": "60c988a84401fa15888a32833e5848e9caa99a45778310ba7b363165",
"id": "3dbf5b00-dabc-41ff-b6ab-4409568fae9d",
"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/3dbf5b00-dabc-41ff-b6ab-4409568fae9d",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/servers/3dbf5b00-dabc-41ff-b6ab-4409568fae9d",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "2013-01-30T13:26:52Z",
"user_id": "fake"
}
]
}

View File

@ -1,5 +1,7 @@
{ {
"server": { "server": {
"accessIPv4": "1.2.3.4",
"accessIPv6": "80fe::",
"addresses": { "addresses": {
"private": [ "private": [
{ {
@ -15,7 +17,7 @@
"id": "1", "id": "1",
"links": [ "links": [
{ {
"href": "http://openstack.example.com/flavors/1", "href": "http://openstack.example.com/openstack/flavors/1",
"rel": "bookmark" "rel": "bookmark"
} }
] ]
@ -26,7 +28,7 @@
"id": "70a599e0-31e7-49b7-b260-868f441e862b", "id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [ "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" "rel": "bookmark"
} }
] ]
@ -34,11 +36,11 @@
"key_name": null, "key_name": null,
"links": [ "links": [
{ {
"href": "http://openstack.example.com/v3/servers/f22e4521-d03a-4e9f-9fd3-016b9e227219", "href": "http://openstack.example.com/v2/openstack/servers/f22e4521-d03a-4e9f-9fd3-016b9e227219",
"rel": "self" "rel": "self"
}, },
{ {
"href": "http://openstack.example.com/servers/f22e4521-d03a-4e9f-9fd3-016b9e227219", "href": "http://openstack.example.com/openstack/servers/f22e4521-d03a-4e9f-9fd3-016b9e227219",
"rel": "bookmark" "rel": "bookmark"
} }
], ],

View File

@ -1,6 +1,8 @@
{ {
"servers": [ "servers": [
{ {
"accessIPv4": "1.2.3.4",
"accessIPv6": "80fe::",
"addresses": { "addresses": {
"private": [ "private": [
{ {
@ -16,7 +18,7 @@
"id": "1", "id": "1",
"links": [ "links": [
{ {
"href": "http://openstack.example.com/flavors/1", "href": "http://openstack.example.com/openstack/flavors/1",
"rel": "bookmark" "rel": "bookmark"
} }
] ]
@ -27,7 +29,7 @@
"id": "70a599e0-31e7-49b7-b260-868f441e862b", "id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [ "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" "rel": "bookmark"
} }
] ]
@ -35,11 +37,11 @@
"key_name": null, "key_name": null,
"links": [ "links": [
{ {
"href": "http://openstack.example.com/v3/servers/55f43fa2-dc7c-4c0b-b21a-76f9abe516f9", "href": "http://openstack.example.com/v2/openstack/servers/55f43fa2-dc7c-4c0b-b21a-76f9abe516f9",
"rel": "self" "rel": "self"
}, },
{ {
"href": "http://openstack.example.com/servers/55f43fa2-dc7c-4c0b-b21a-76f9abe516f9", "href": "http://openstack.example.com/openstack/servers/55f43fa2-dc7c-4c0b-b21a-76f9abe516f9",
"rel": "bookmark" "rel": "bookmark"
} }
], ],

View File

@ -1,55 +0,0 @@
{
"server": {
"updated": "%(isotime)s",
"created": "%(isotime)s",
"OS-EXT-AZ:availability_zone": "nova",
"accessIPv4": "",
"accessIPv6": "",
"addresses": {
"private": [
{
"addr": "%(ip)s",
"version": 4
}
]
},
"flavor": {
"id": "1",
"links": [
{
"href": "%(host)s/openstack/flavors/1",
"rel": "bookmark"
}
]
},
"hostId": "%(hostid)s",
"id": "%(uuid)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",
"user_id": "fake"
}
}

View File

@ -1,57 +0,0 @@
{
"servers": [
{
"updated": "%(isotime)s",
"created": "%(isotime)s",
"OS-EXT-AZ:availability_zone": "nova",
"accessIPv4": "",
"accessIPv6": "",
"addresses": {
"private": [
{
"addr": "%(ip)s",
"version": 4
}
]
},
"flavor": {
"id": "1",
"links": [
{
"href": "%(host)s/openstack/flavors/1",
"rel": "bookmark"
}
]
},
"hostId": "%(hostid)s",
"id": "%(uuid)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",
"user_id": "fake"
}
]
}

View File

@ -1,48 +0,0 @@
{
"availabilityZoneInfo": [
{
"zoneName": "zone-1",
"zoneState": {
"available": true
},
"hosts": {
"fake_host-1": {
"nova-compute": {
"active": true,
"available": true,
"updated_at": "2012-12-26T14:45:25.000000"
}
}
}
},
{
"zoneName": "internal",
"zoneState": {
"available": true
},
"hosts": {
"fake_host-1": {
"nova-sched": {
"active": true,
"available": true,
"updated_at": "2012-12-26T14:45:25.000000"
}
},
"fake_host-2": {
"nova-network": {
"active": true,
"available": false,
"updated_at": "2012-12-26T14:45:24.000000"
}
}
}
},
{
"zoneName": "zone-2",
"zoneState": {
"available": false
},
"hosts": null
}
]
}

View File

@ -1,18 +0,0 @@
{
"availabilityZoneInfo": [
{
"zoneName": "zone-1",
"zoneState": {
"available": true
},
"hosts": null
},
{
"zoneName": "zone-2",
"zoneState": {
"available": false
},
"hosts": null
}
]
}

View File

@ -247,22 +247,6 @@ class UsedLimitsForAdminSamplesJsonTest(ApiSampleTestBaseV2):
response, 200) response, 200)
class AvailabilityZoneJsonTest(ServersSampleBase):
extension_name = ("nova.api.openstack.compute.contrib.availability_zone."
"Availability_zone")
def test_create_availability_zone(self):
subs = {
'image_id': fake.get_valid_image_id(),
'host': self._get_host(),
"availability_zone": "nova"
}
response = self._do_post('servers', 'availability-zone-post-req', subs)
subs.update(self._get_regexes())
self._verify_response('availability-zone-post-resp', subs,
response, 202)
class ExtendedIpsSampleJsonTests(ServersSampleBase): class ExtendedIpsSampleJsonTests(ServersSampleBase):
extension_name = ("nova.api.openstack.compute.contrib" extension_name = ("nova.api.openstack.compute.contrib"
".extended_ips.Extended_ips") ".extended_ips.Extended_ips")
@ -357,26 +341,6 @@ class BlockDeviceMappingV2BootJsonTest(ServersSampleBase):
return self._post_server() return self._post_server()
class ExtendedAvailabilityZoneJsonTests(ServersSampleBase):
extension_name = ("nova.api.openstack.compute.contrib"
".extended_availability_zone"
".Extended_availability_zone")
def test_show(self):
uuid = self._post_server()
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):
self._post_server()
response = self._do_get('servers/detail')
subs = self._get_regexes()
subs['hostid'] = '[a-f0-9]+'
self._verify_response('servers-detail-resp', subs, response, 200)
class ServerGroupQuotas_LimitsSampleJsonTest(LimitsSampleJsonTest): class ServerGroupQuotas_LimitsSampleJsonTest(LimitsSampleJsonTest):
sample_dir = None sample_dir = None
extension_name = ("nova.api.openstack.compute.contrib." extension_name = ("nova.api.openstack.compute.contrib."

View File

@ -3,6 +3,8 @@
"updated": "%(isotime)s", "updated": "%(isotime)s",
"created": "%(isotime)s", "created": "%(isotime)s",
"OS-EXT-AZ:availability_zone": "nova", "OS-EXT-AZ:availability_zone": "nova",
"accessIPv4": "%(access_ip_v4)s",
"accessIPv6": "%(access_ip_v6)s",
"addresses": { "addresses": {
"private": [ "private": [
{ {
@ -17,7 +19,7 @@
"id": "1", "id": "1",
"links": [ "links": [
{ {
"href": "%(host)s/flavors/1", "href": "%(host)s/openstack/flavors/1",
"rel": "bookmark" "rel": "bookmark"
} }
] ]
@ -28,18 +30,18 @@
"id": "%(uuid)s", "id": "%(uuid)s",
"links": [ "links": [
{ {
"href": "%(host)s/images/%(uuid)s", "href": "%(host)s/openstack/images/%(uuid)s",
"rel": "bookmark" "rel": "bookmark"
} }
] ]
}, },
"links": [ "links": [
{ {
"href": "%(host)s/v3/servers/%(uuid)s", "href": "%(host)s/v2/openstack/servers/%(uuid)s",
"rel": "self" "rel": "self"
}, },
{ {
"href": "%(host)s/servers/%(uuid)s", "href": "%(host)s/openstack/servers/%(uuid)s",
"rel": "bookmark" "rel": "bookmark"
} }
], ],

View File

@ -4,6 +4,8 @@
"updated": "%(isotime)s", "updated": "%(isotime)s",
"created": "%(isotime)s", "created": "%(isotime)s",
"OS-EXT-AZ:availability_zone": "nova", "OS-EXT-AZ:availability_zone": "nova",
"accessIPv4": "%(access_ip_v4)s",
"accessIPv6": "%(access_ip_v6)s",
"addresses": { "addresses": {
"private": [ "private": [
{ {
@ -18,7 +20,7 @@
"id": "1", "id": "1",
"links": [ "links": [
{ {
"href": "%(host)s/flavors/1", "href": "%(host)s/openstack/flavors/1",
"rel": "bookmark" "rel": "bookmark"
} }
] ]
@ -29,18 +31,18 @@
"id": "%(uuid)s", "id": "%(uuid)s",
"links": [ "links": [
{ {
"href": "%(host)s/images/%(uuid)s", "href": "%(host)s/openstack/images/%(uuid)s",
"rel": "bookmark" "rel": "bookmark"
} }
] ]
}, },
"links": [ "links": [
{ {
"href": "%(host)s/v3/servers/%(id)s", "href": "%(host)s/v2/openstack/servers/%(id)s",
"rel": "self" "rel": "self"
}, },
{ {
"href": "%(host)s/servers/%(id)s", "href": "%(host)s/openstack/servers/%(id)s",
"rel": "bookmark" "rel": "bookmark"
} }
], ],

View File

@ -18,11 +18,26 @@ from nova.tests.functional.v3 import test_servers
CONF = cfg.CONF CONF = cfg.CONF
CONF.import_opt('manager', 'nova.cells.opts', group='cells') CONF.import_opt('manager', 'nova.cells.opts', group='cells')
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.extensions')
class AvailabilityZoneJsonTest(test_servers.ServersSampleBase): class AvailabilityZoneJsonTest(test_servers.ServersSampleBase):
ADMIN_API = True ADMIN_API = True
extension_name = "os-availability-zone" extension_name = "os-availability-zone"
extra_extensions_to_load = ["os-access-ips"]
# TODO(gmann): 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(AvailabilityZoneJsonTest, self)._get_flags()
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
f['osapi_compute_extension'].append(
'nova.api.openstack.compute.contrib.availability_zone.'
'Availability_zone')
return f
def _setup_services(self): def _setup_services(self):
self.conductor = self.start_service('conductor', self.conductor = self.start_service('conductor',

View File

@ -13,17 +13,45 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo_config import cfg
from nova.tests.functional.v3 import test_servers from nova.tests.functional.v3 import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.extensions')
class ExtendedAvailabilityZoneJsonTests(test_servers.ServersSampleBase): class ExtendedAvailabilityZoneJsonTests(test_servers.ServersSampleBase):
extension_name = "os-extended-availability-zone" extension_name = "os-extended-availability-zone"
extra_extensions_to_load = ["os-access-ips"]
# TODO(gmann): 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(ExtendedAvailabilityZoneJsonTests, self)._get_flags()
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
f['osapi_compute_extension'].append(
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
f['osapi_compute_extension'].append(
'nova.api.openstack.compute.contrib.extended_availability_zone.'
'Extended_availability_zone')
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 test_show(self): def test_show(self):
uuid = self._post_server() uuid = self._post_server()
response = self._do_get('servers/%s' % uuid) response = self._do_get('servers/%s' % uuid)
subs = self._get_regexes() subs = self._get_regexes()
subs['hostid'] = '[a-f0-9]+' 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) self._verify_response('server-get-resp', subs, response, 200)
def test_detail(self): def test_detail(self):
@ -31,4 +59,6 @@ class ExtendedAvailabilityZoneJsonTests(test_servers.ServersSampleBase):
response = self._do_get('servers/detail') response = self._do_get('servers/detail')
subs = self._get_regexes() subs = self._get_regexes()
subs['hostid'] = '[a-f0-9]+' 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) self._verify_response('servers-detail-resp', subs, response, 200)