speed up tests setting fake rpc polling timeout

The fake rpc driver's polling implementation doesn't understand
situations where there will never be another event, and instead polls
until the timeout in many cases (especially during test cleanup). For
functional tests this increases the run time of tests by over 50% due
to delays on the cleanup side.

This is slated to be addressed in the next oslo.messaging release, but
until we require > 1.5.1 this work around will dramatically speed up
testing.

Change-Id: I59b3be79e6de8fef9a716527cf302f5e881098ae
This commit is contained in:
Sean Dague 2015-01-13 10:22:28 -05:00
parent 4185b975ec
commit 5071c09505
1 changed files with 8 additions and 0 deletions

View File

@ -237,6 +237,14 @@ class RPCFixture(fixtures.Fixture):
self.messaging_conf.transport_driver = 'fake'
self.useFixture(self.messaging_conf)
rpc.init(CONF)
# NOTE(sdague): the polling behavior in oslo.messaging <=
# 1.5.1 fake driver is less than optimal, as by default the
# polling will wait for a full second even if there are no
# events available. Turning this down speeds up the tests
# substantially.
self.useFixture(fixtures.MonkeyPatch(
'oslo.messaging._executors.base.POLL_TIMEOUT',
0.001))
class WarningsFixture(fixtures.Fixture):