Merge "More robust mocking of nova conductor"
This commit is contained in:
commit
d33d20c372
@ -91,6 +91,7 @@ class TestNovaNotifier(base.TestCase):
|
||||
super(TestNovaNotifier, self).setUp()
|
||||
nova_CONF.compute_driver = 'nova.virt.fake.FakeDriver'
|
||||
nova_CONF.notification_driver = [nova_notifier.__name__]
|
||||
nova_CONF.rpc_backend = 'ceilometer.openstack.common.rpc.impl_fake'
|
||||
self.compute = importutils.import_object(nova_CONF.compute_manager)
|
||||
self.context = context.get_admin_context()
|
||||
fake_network.set_stub_network_methods(self.stubs)
|
||||
@ -168,19 +169,13 @@ class TestNovaNotifier(base.TestCase):
|
||||
# the nova manager and the remote system since we can't
|
||||
# expect the message bus to be available, or the remote
|
||||
# controller to be there if the message bus is online.
|
||||
@mock.patch.object(nova.conductor.api.API,
|
||||
'block_device_mapping_get_all_by_instance',
|
||||
lambda obj, context, instance: {})
|
||||
@mock.patch.object(self.compute, 'conductor_api')
|
||||
# The code that looks up the instance uses a global
|
||||
# reference to the API, so we also have to patch that to
|
||||
# return our fake data.
|
||||
@mock.patch.object(nova.conductor.api.API,
|
||||
'instance_get_by_uuid',
|
||||
self.fake_db_instance_get)
|
||||
@mock.patch('nova.conductor.api.API.instance_info_cache_delete')
|
||||
@mock.patch('nova.conductor.api.API.instance_destroy')
|
||||
@mock.patch('nova.conductor.api.API.block_device_mapping_destroy')
|
||||
@mock.patch('nova.conductor.api.API.instance_update')
|
||||
@mock.patch('nova.conductor.api.API.action_event_start')
|
||||
@mock.patch('nova.conductor.api.API.action_event_finish')
|
||||
@mock.patch('nova.compute.utils.add_instance_fault_from_exc')
|
||||
def run_test(*omit_args):
|
||||
self.compute.terminate_instance(self.context,
|
||||
instance=self.instance)
|
||||
|
Loading…
x
Reference in New Issue
Block a user