]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove duplicated mock patch of ip_lib
authorKevin Benton <blak111@gmail.com>
Fri, 26 Jun 2015 05:08:41 +0000 (22:08 -0700)
committerKevin Benton <kevinbenton@buttewifi.com>
Fri, 26 Jun 2015 20:17:46 +0000 (20:17 +0000)
The functional tests for agents were patching ip_lib in the
function to configure an agent, so any tests that relied on
multiple agents would patch ip_lib multiple times.

Partial-Bug: #1468998
Change-Id: Ibccf586dea870ec222369c0876f17f8eaf9a1aca

neutron/tests/functional/agent/test_l3_agent.py

index 8631e9d2722f1a0cf10ee17e43bcbf5fdc785a4e..74d2e486f95c3471ca1ebf47204458c5b9b1742f 100644 (file)
@@ -68,6 +68,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
         self.mock_plugin_api = mock.patch(
             'neutron.agent.l3.agent.L3PluginApi').start().return_value
         mock.patch('neutron.agent.rpc.PluginReportStateAPI').start()
+        mock.patch.object(ip_lib, '_arping').start()
         self.agent = self._configure_agent('agent1')
 
     def _get_config_opts(self):
@@ -104,7 +105,6 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
                           get_temp_file_path('external/pids'))
         conf.set_override('host', host)
         agent = neutron_l3_agent.L3NATAgentWithStateReport(host, conf)
-        mock.patch.object(ip_lib, '_arping').start()
 
         return agent