]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix random OverflowError exceptions in gate-neutron-python26 tests
authorarmando-migliaccio <amigliaccio@nicira.com>
Mon, 15 Jul 2013 18:08:13 +0000 (11:08 -0700)
committerarmando-migliaccio <amigliaccio@nicira.com>
Mon, 15 Jul 2013 19:56:27 +0000 (12:56 -0700)
These errors seem to be linked to the NEC plugin and http connections
not being stubbed out correctly. This patch ensures do_request is
stubbed out prior to the tests execution; this should be enough
to prevent timeouts from occurring again. Stubbing out the call has
no effect on the coverage of the agent scheduler tests for the NEC
plugin.

Fixes bug #1201478

Change-Id: Iee3cb3cb3137cedcf97c707ea7fde9114b7264b6

neutron/tests/unit/nec/test_agent_scheduler.py

index a54f4bdae93c21fab1f176f6debadc9905956e0c..68dd70e18af89687f8fd09e578f1f2eb6e0553b3 100644 (file)
@@ -15,6 +15,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import mox
+
+from neutron.plugins.nec.common import ofc_client
 from neutron.tests.unit.nec import test_nec_plugin
 from neutron.tests.unit.openvswitch import test_agent_scheduler
 
@@ -23,12 +26,30 @@ class NecAgentSchedulerTestCase(
     test_agent_scheduler.OvsAgentSchedulerTestCase):
     plugin_str = test_nec_plugin.PLUGIN_NAME
 
+    def setUp(self):
+        super(NecAgentSchedulerTestCase, self).setUp()
+        self.mox = mox.Mox()
+        self.mox.StubOutWithMock(ofc_client.OFCClient, 'do_request')
+        self.addCleanup(self.mox.UnsetStubs)
+
 
 class NecDhcpAgentNotifierTestCase(
     test_agent_scheduler.OvsDhcpAgentNotifierTestCase):
     plugin_str = test_nec_plugin.PLUGIN_NAME
 
+    def setUp(self):
+        super(NecDhcpAgentNotifierTestCase, self).setUp()
+        self.mox = mox.Mox()
+        self.mox.StubOutWithMock(ofc_client.OFCClient, 'do_request')
+        self.addCleanup(self.mox.UnsetStubs)
+
 
 class NecL3AgentNotifierTestCase(
     test_agent_scheduler.OvsL3AgentNotifierTestCase):
     plugin_str = test_nec_plugin.PLUGIN_NAME
+
+    def setUp(self):
+        super(NecL3AgentNotifierTestCase, self).setUp()
+        self.mox = mox.Mox()
+        self.mox.StubOutWithMock(ofc_client.OFCClient, 'do_request')
+        self.addCleanup(self.mox.UnsetStubs)