Stop loading OVOServerRpcInterface in ML2 testcase
This RPC notifier has an asynchronous handler that does DB lookups to send notifications after an object has been created. Not only is this a waste of resources in unit tests, it interferes with tests that are inspecting the DB queries that occur between calls. This just blocks the OVOServerRpcInterface in the ML2 test case and then enables it for the set of unit tests that needs it. Change-Id: I807e2445da9be241c24d8b6e5bda8b12927aa7fc Closes-Bug: #1679775
This commit is contained in:
parent
301d59f88f
commit
9c43959651
@ -18,6 +18,7 @@ from neutron_lib.plugins import directory
|
||||
from neutron.objects import network
|
||||
from neutron.objects import securitygroup
|
||||
from neutron.objects import subnet
|
||||
from neutron.plugins.ml2 import ovo_rpc
|
||||
from neutron.tests.unit.plugins.ml2 import test_plugin
|
||||
|
||||
|
||||
@ -31,6 +32,9 @@ class OVOServerRpcInterfaceTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||
receive = lambda s, ctx, obs, evt: self.received.append((obs[0], evt))
|
||||
mock.patch('neutron.api.rpc.handlers.resources_rpc.'
|
||||
'ResourcesPushRpcApi.push', new=receive).start()
|
||||
# base case blocks the handler
|
||||
self.ovo_push_interface_p.stop()
|
||||
self.plugin.ovo_notifier = ovo_rpc.OVOServerRpcInterface()
|
||||
|
||||
def _assert_object_received(self, ovotype, oid=None, event=None):
|
||||
self.plugin.ovo_notifier.wait()
|
||||
|
@ -127,6 +127,9 @@ class Ml2PluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
self.port_create_status = 'DOWN'
|
||||
|
||||
def setUp(self):
|
||||
self.ovo_push_interface_p = mock.patch(
|
||||
'neutron.plugins.ml2.ovo_rpc.OVOServerRpcInterface')
|
||||
self.ovo_push_interface_p.start()
|
||||
# Enable the test mechanism driver to ensure that
|
||||
# we can successfully call through to all mechanism
|
||||
# driver apis.
|
||||
|
Loading…
Reference in New Issue
Block a user