From: Russell Bryant Date: Mon, 1 Dec 2014 20:13:12 +0000 (+0000) Subject: Don't block on rpc calls in unit tests X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d356e2f9f7907010f3a3c0648cfc69f3796a1af7;p=openstack-build%2Fneutron-build.git Don't block on rpc calls in unit tests 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 --- diff --git a/neutron/tests/base.py b/neutron/tests/base.py index b4bd93a4c..b39d8595b 100644 --- a/neutron/tests/base.py +++ b/neutron/tests/base.py @@ -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)