]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix TestDhcpAgentEventHandler test that fails in some Jenkins runs.
authorEugene Nikanorov <enikanorov@mirantis.com>
Fri, 12 Jul 2013 19:02:30 +0000 (23:02 +0400)
committerEugene Nikanorov <enikanorov@mirantis.com>
Fri, 12 Jul 2013 19:49:29 +0000 (23:49 +0400)
Add mocking of check_version method that have ran dnsmasq process to retrieve version

fixes bug 1200698

Change-Id: I6476d62bc4394bdf9701a2aa26a435f8bcb00d0d

neutron/tests/unit/test_dhcp_agent.py

index 9a15bf0ea908e5c8fcf9b29ba041aa9fb8623d52..0205bcfa0faac4fd381a5b335e3d9179e154dbaf 100644 (file)
@@ -442,7 +442,10 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
         self.cache = mock.Mock()
         cache_cls.return_value = self.cache
 
-        self.dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
+        with mock.patch.object(dhcp.Dnsmasq,
+                               'check_version') as check_v:
+            check_v.return_value = dhcp.Dnsmasq.MINIMUM_VERSION
+            self.dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
         self.call_driver_p = mock.patch.object(self.dhcp, 'call_driver')
 
         self.call_driver = self.call_driver_p.start()