]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Don't block on rpc calls in unit tests
authorRussell Bryant <rbryant@redhat.com>
Mon, 1 Dec 2014 20:13:12 +0000 (20:13 +0000)
committerRussell Bryant <rbryant@redhat.com>
Tue, 2 Dec 2014 14:11:58 +0000 (14:11 +0000)
While running unit tests I noticed that all of the test cases from
TestOvsNeutronAgent were taking just over 15 seconds.  This is because
it was waiting for the rpc call response timeout.  Since the tests
weren't actually failing, it's clear the code doesn't actually care
about the response anyway, so just set the messaging config to not
wait for the response.

On my dev box, this dropped test runtime for this file from 1024
seconds to 3 seconds, which is an obvious *HUGE* improvement.

Someone pointed out that an earlier change
(086496bfc45e01cd2905a074d526a7d513bf4ec2) intended to make calls
return immediately for *all* tests, but removing use of RpcProxy
caused this to stop working.

Change-Id: Id07c1d1727a3f4087f0a97681388fb5d69740f8d

neutron/tests/base.py

index b4bd93a4cdc101301f82ae422ea8ee63cb20d983..b39d8595b4691cfe43f82addaba64bc4fc52300a 100644 (file)
@@ -151,7 +151,8 @@ class BaseTestCase(testtools.TestCase):
 
         self.messaging_conf = messaging_conffixture.ConfFixture(CONF)
         self.messaging_conf.transport_driver = 'fake'
-        self.messaging_conf.response_timeout = 15
+        # NOTE(russellb) We want all calls to return immediately.
+        self.messaging_conf.response_timeout = 0
         self.useFixture(self.messaging_conf)
 
         self.addCleanup(n_rpc.clear_extra_exmods)