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()
|
super(TestNovaNotifier, self).setUp()
|
||||||
nova_CONF.compute_driver = 'nova.virt.fake.FakeDriver'
|
nova_CONF.compute_driver = 'nova.virt.fake.FakeDriver'
|
||||||
nova_CONF.notification_driver = [nova_notifier.__name__]
|
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.compute = importutils.import_object(nova_CONF.compute_manager)
|
||||||
self.context = context.get_admin_context()
|
self.context = context.get_admin_context()
|
||||||
fake_network.set_stub_network_methods(self.stubs)
|
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
|
# the nova manager and the remote system since we can't
|
||||||
# expect the message bus to be available, or the remote
|
# expect the message bus to be available, or the remote
|
||||||
# controller to be there if the message bus is online.
|
# controller to be there if the message bus is online.
|
||||||
@mock.patch.object(nova.conductor.api.API,
|
@mock.patch.object(self.compute, 'conductor_api')
|
||||||
'block_device_mapping_get_all_by_instance',
|
# The code that looks up the instance uses a global
|
||||||
lambda obj, context, instance: {})
|
# reference to the API, so we also have to patch that to
|
||||||
|
# return our fake data.
|
||||||
@mock.patch.object(nova.conductor.api.API,
|
@mock.patch.object(nova.conductor.api.API,
|
||||||
'instance_get_by_uuid',
|
'instance_get_by_uuid',
|
||||||
self.fake_db_instance_get)
|
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):
|
def run_test(*omit_args):
|
||||||
self.compute.terminate_instance(self.context,
|
self.compute.terminate_instance(self.context,
|
||||||
instance=self.instance)
|
instance=self.instance)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user