]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix haproxy agent unit test to be runnable alone by tox
authorEugene Nikanorov <enikanorov@mirantis.com>
Sat, 14 Sep 2013 10:26:53 +0000 (14:26 +0400)
committerEugene Nikanorov <enikanorov@mirantis.com>
Sat, 14 Sep 2013 10:26:53 +0000 (14:26 +0400)
haproxy agent uses periodic_interval option that can interfere
with the same option declared in neutron/service.py when running
'tox services.loadbalancer'

Change-Id: Ibcc91d603f5f31c7a376e0c735e8bf566198231d
Closes-Bug: #1221726

neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_agent.py

index 45161bc2d2528b6bb38a47f646ca44c18febcda3..201b2ca90b532ca9109dc67d5061d53307796498 100644 (file)
@@ -29,8 +29,6 @@ class TestLbaasService(base.BaseTestCase):
         super(TestLbaasService, self).setUp()
         self.addCleanup(cfg.CONF.reset)
 
-        cfg.CONF.register_opts(agent.OPTS)
-
     def test_start(self):
         with mock.patch.object(
             agent.rpc_service.Service, 'start'
@@ -49,8 +47,9 @@ class TestLbaasService(base.BaseTestCase):
             mock.patch.object(agent.service, 'launch'),
             mock.patch.object(agent, 'eventlet'),
             mock.patch('sys.argv'),
-            mock.patch.object(agent.manager, 'LbaasAgentManager')
-        ) as (mock_logging, mock_launch, mock_eventlet, sys_argv, mgr_cls):
+            mock.patch.object(agent.manager, 'LbaasAgentManager'),
+            mock.patch.object(cfg.CONF, 'register_opts')
+        ) as (mock_logging, mock_launch, mock_eventlet, sys_argv, mgr_cls, ro):
             agent.main()
 
             self.assertTrue(mock_eventlet.monkey_patch.called)