]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove double mock of dhcp agent periodic check
authorKevin Benton <blak111@gmail.com>
Fri, 26 Jun 2015 01:29:37 +0000 (18:29 -0700)
committerKevin Benton <blak111@gmail.com>
Fri, 26 Jun 2015 01:38:17 +0000 (18:38 -0700)
The test case for the periodic check was patching a target
that the core plugin fixture already patched out. This removes
that and exposes the mock from the fixture so the test case
can reference it.

Change-Id: I3adee6a875c497e070db4198567b52aa16b81ce8
Partial-Bug: #1468998

neutron/tests/base.py
neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py

index ca32e7a0c131685cee97bd2e533df1cfe5fb1ae6..31068a97755703cf1b0936da302e6d6e4a837cad 100644 (file)
@@ -370,7 +370,9 @@ class BaseTestCase(DietTestCase):
             CONF.set_override(k, v, group)
 
     def setup_coreplugin(self, core_plugin=None):
-        self.useFixture(PluginFixture(core_plugin))
+        cp = PluginFixture(core_plugin)
+        self.useFixture(cp)
+        self.patched_dhcp_periodic = cp.patched_dhcp_periodic
 
     def setup_notification_driver(self, notification_driver=None):
         self.addCleanup(fake_notifier.reset)
index 260a5b01a8d85f0f66abe63be749d75a905179e5..6dc8b68e9694ae1729837e6c3740ab4455c9cdc4 100644 (file)
@@ -277,10 +277,6 @@ class DHCPAgentWeightSchedulerTestCase(TestDhcpSchedulerBaseTestCase):
         self.setup_coreplugin(DB_PLUGIN_KLASS)
         cfg.CONF.set_override("network_scheduler_driver",
             'neutron.scheduler.dhcp_agent_scheduler.WeightScheduler')
-        self.dhcp_periodic_p = mock.patch(
-            'neutron.db.agentschedulers_db.DhcpAgentSchedulerDbMixin.'
-            'start_periodic_dhcp_agent_status_check')
-        self.patched_dhcp_periodic = self.dhcp_periodic_p.start()
         self.plugin = importutils.import_object('neutron.plugins.ml2.plugin.'
                                                 'Ml2Plugin')
         self.assertEqual(1, self.patched_dhcp_periodic.call_count)