Merge "Remove the usage of extension black/white list opts in multi-create"
This commit is contained in:
commit
5a3f02030c
@ -52,10 +52,6 @@ class MultiCreateExtensionTestV21(test.TestCase):
|
|||||||
ext_info = extension_info.LoadedExtensionInfo()
|
ext_info = extension_info.LoadedExtensionInfo()
|
||||||
self.controller = servers_v21.ServersController(
|
self.controller = servers_v21.ServersController(
|
||||||
extension_info=ext_info)
|
extension_info=ext_info)
|
||||||
CONF.set_override('extensions_blacklist', 'os-multiple-create',
|
|
||||||
'osapi_v21')
|
|
||||||
self.no_mult_create_controller = servers_v21.ServersController(
|
|
||||||
extension_info=ext_info)
|
|
||||||
|
|
||||||
def instance_get(context, instance_id):
|
def instance_get(context, instance_id):
|
||||||
"""Stub for compute/api create() pulling in instance after
|
"""Stub for compute/api create() pulling in instance after
|
||||||
@ -101,47 +97,16 @@ class MultiCreateExtensionTestV21(test.TestCase):
|
|||||||
fake_method)
|
fake_method)
|
||||||
self.req = fakes.HTTPRequest.blank('')
|
self.req = fakes.HTTPRequest.blank('')
|
||||||
|
|
||||||
def _test_create_extra(self, params, no_image=False,
|
def _test_create_extra(self, params, no_image=False):
|
||||||
override_controller=None):
|
|
||||||
image_uuid = 'c905cedb-7281-47e4-8a62-f26bc5fc4c77'
|
image_uuid = 'c905cedb-7281-47e4-8a62-f26bc5fc4c77'
|
||||||
server = dict(name='server_test', imageRef=image_uuid, flavorRef=2)
|
server = dict(name='server_test', imageRef=image_uuid, flavorRef=2)
|
||||||
if no_image:
|
if no_image:
|
||||||
server.pop('imageRef', None)
|
server.pop('imageRef', None)
|
||||||
server.update(params)
|
server.update(params)
|
||||||
body = dict(server=server)
|
body = dict(server=server)
|
||||||
if override_controller:
|
|
||||||
server = override_controller.create(self.req,
|
|
||||||
body=body).obj['server']
|
|
||||||
else:
|
|
||||||
server = self.controller.create(self.req,
|
server = self.controller.create(self.req,
|
||||||
body=body).obj['server']
|
body=body).obj['server']
|
||||||
|
|
||||||
def _check_multiple_create_extension_disabled(self, **kwargs):
|
|
||||||
# NOTE: on v2.1 API, "create a server" API doesn't add the following
|
|
||||||
# attributes into kwargs when non-loading multiple_create extension.
|
|
||||||
# However, v2.0 API adds them as values "1" instead. So we need to
|
|
||||||
# define checking methods for each API here.
|
|
||||||
self.assertNotIn('min_count', kwargs)
|
|
||||||
self.assertNotIn('max_count', kwargs)
|
|
||||||
|
|
||||||
def test_create_instance_with_multiple_create_disabled(self):
|
|
||||||
min_count = 2
|
|
||||||
max_count = 3
|
|
||||||
params = {
|
|
||||||
multiple_create_v21.MIN_ATTRIBUTE_NAME: min_count,
|
|
||||||
multiple_create_v21.MAX_ATTRIBUTE_NAME: max_count,
|
|
||||||
}
|
|
||||||
old_create = compute_api.API.create
|
|
||||||
|
|
||||||
def create(*args, **kwargs):
|
|
||||||
self._check_multiple_create_extension_disabled(**kwargs)
|
|
||||||
return old_create(*args, **kwargs)
|
|
||||||
|
|
||||||
self.stub_out('nova.compute.api.API.create', create)
|
|
||||||
self._test_create_extra(
|
|
||||||
params,
|
|
||||||
override_controller=self.no_mult_create_controller)
|
|
||||||
|
|
||||||
def test_multiple_create_with_string_type_min_and_max(self):
|
def test_multiple_create_with_string_type_min_and_max(self):
|
||||||
min_count = '2'
|
min_count = '2'
|
||||||
max_count = '3'
|
max_count = '3'
|
||||||
|
Loading…
Reference in New Issue
Block a user