From 226ca878d6743d6e05d0430fb66e266da966ad85 Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Wed, 4 Sep 2013 12:22:23 -0700 Subject: [PATCH] Ensure unit tests do not let looping calls roam freely Bug 1220871 This patch does minimal changes in neutron.plugins.nicira.common.sync providing unit tests with a reference to the looping call object, so that they can control its lifecycle. Also, it perform a bit of refactoring in test_l3_agent.py in the way mocks are created and started. Change-Id: I73a1eb8ecdb7c6d46ff12afba549dd27095b7202 --- neutron/tests/unit/services/vpn/test_vpn_agent.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neutron/tests/unit/services/vpn/test_vpn_agent.py b/neutron/tests/unit/services/vpn/test_vpn_agent.py index 623bfcc97..f22c18c0b 100644 --- a/neutron/tests/unit/services/vpn/test_vpn_agent.py +++ b/neutron/tests/unit/services/vpn/test_vpn_agent.py @@ -75,6 +75,10 @@ class TestVPNAgent(base.BaseTestCase): self.plugin_api = mock.Mock() l3pluginApi_cls.return_value = self.plugin_api + looping_call_p = mock.patch( + 'neutron.openstack.common.loopingcall.FixedIntervalLoopingCall') + looping_call_p.start() + self.fake_host = 'fake_host' self.agent = agent.VPNAgent(self.fake_host)