Merge "Skip spawn plugin init methods in unittests"

This commit is contained in:
Jenkins 2017-03-29 19:24:18 +00:00 committed by Gerrit Code Review
commit 7ba23fdc01
2 changed files with 26 additions and 1 deletions

View File

@ -158,6 +158,17 @@ class NsxVPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
mock_delete_dhcp_service = mock.patch("%s.%s" % ( mock_delete_dhcp_service = mock.patch("%s.%s" % (
vmware.EDGE_MANAGE_NAME, 'delete_dhcp_edge_service')) vmware.EDGE_MANAGE_NAME, 'delete_dhcp_edge_service'))
mock_delete_dhcp_service.start() mock_delete_dhcp_service.start()
mock_check_backup_edge_pools = mock.patch("%s.%s" % (
vmware.EDGE_MANAGE_NAME, '_check_backup_edge_pools'))
mock_check_backup_edge_pools.start()
mock_deploy_backup_edges_at_backend = mock.patch("%s.%s" % (
vmware.EDGE_MANAGE_NAME, '_deploy_backup_edges_at_backend'))
mock_deploy_backup_edges_at_backend.start()
mock_process_security_group_logging = mock.patch(
'vmware_nsx.plugin.NsxVPlugin.'
'_process_security_groups_rules_logging')
mock_process_security_group_logging.start()
self.default_res_pool = 'respool-28' self.default_res_pool = 'respool-28'
cfg.CONF.set_override("resource_pool_id", self.default_res_pool, cfg.CONF.set_override("resource_pool_id", self.default_res_pool,
group="nsxv") group="nsxv")
@ -3372,6 +3383,14 @@ class NsxVSecurityGroupsTestCase(ext_sg.SecurityGroupDBTestCase):
mock_delete_dhcp_service = mock.patch("%s.%s" % ( mock_delete_dhcp_service = mock.patch("%s.%s" % (
vmware.EDGE_MANAGE_NAME, 'delete_dhcp_edge_service')) vmware.EDGE_MANAGE_NAME, 'delete_dhcp_edge_service'))
mock_delete_dhcp_service.start() mock_delete_dhcp_service.start()
mock_check_backup_edge_pools = mock.patch("%s.%s" % (
vmware.EDGE_MANAGE_NAME, '_check_backup_edge_pools'))
mock_check_backup_edge_pools.start()
mock_process_security_group_logging = mock.patch(
'vmware_nsx.plugin.NsxVPlugin.'
'_process_security_groups_rules_logging')
mock_process_security_group_logging.start()
c_utils.spawn_n = mock.Mock(side_effect=lambda f: f()) c_utils.spawn_n = mock.Mock(side_effect=lambda f: f())
super(NsxVSecurityGroupsTestCase, self).setUp(plugin=plugin, super(NsxVSecurityGroupsTestCase, self).setUp(plugin=plugin,
ext_mgr=ext_mgr) ext_mgr=ext_mgr)

View File

@ -160,6 +160,12 @@ class NsxV3PluginTestCaseMixin(test_plugin.NeutronDbPluginV2TestCase,
'network_scheduler_driver', 'network_scheduler_driver',
'neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler') 'neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler')
def mock_plugin_methods(self):
# mock unnecessary call which causes spawn
mock_process_security_group_logging = mock.patch.object(
nsx_plugin.NsxV3Plugin, '_process_security_group_logging')
mock_process_security_group_logging.start()
def setUp(self, plugin=PLUGIN_NAME, def setUp(self, plugin=PLUGIN_NAME,
ext_mgr=None, ext_mgr=None,
service_plugins=None): service_plugins=None):
@ -168,7 +174,7 @@ class NsxV3PluginTestCaseMixin(test_plugin.NeutronDbPluginV2TestCase,
_mock_nsx_backend_calls() _mock_nsx_backend_calls()
self.setup_conf_overrides() self.setup_conf_overrides()
self.mock_plugin_methods()
super(NsxV3PluginTestCaseMixin, self).setUp(plugin=plugin, super(NsxV3PluginTestCaseMixin, self).setUp(plugin=plugin,
ext_mgr=ext_mgr) ext_mgr=ext_mgr)