Cleanup inflight rpc messages between test cases
The oslo_messaging._drivers.impl_fake.FakeExchangeManager._exchanges [1]
is a dict keyed by exchange name, "nova" for the nova services, and the
value is a FakeExchange that simulate a message bus for our tests.
It is basically a queue holding messages between FakeDriver instances
running in our rpc servers.
As FakeExchangeManager._exchanges is a class level variable it does not
get re-initialized between test cases that are running in the same
process.
So one test case can put an rpc message in the exchange that gets
delivered to the rpc server in a subsequent test case. This issue
made visible by the first patch set of the patch[2]
[1] 648ad56c86/oslo_messaging/_drivers/impl_fake.py (L149)
[2] https://review.openstack.org/#/c/635859/1
Change-Id: Ie60d783a970029371ec834aa26ca98252cdab83b
This commit is contained in:
parent
a6963fa685
commit
6b844af57e
|
@ -788,6 +788,11 @@ class RPCFixture(fixtures.Fixture):
|
|||
mock_gtu.return_value = None
|
||||
rpc.init(CONF)
|
||||
|
||||
def cleanup_in_flight_rpc_messages():
|
||||
messaging._drivers.impl_fake.FakeExchangeManager._exchanges = {}
|
||||
|
||||
self.addCleanup(cleanup_in_flight_rpc_messages)
|
||||
|
||||
|
||||
class WarningsFixture(fixtures.Fixture):
|
||||
"""Filters out warnings during test runs."""
|
||||
|
|
Loading…
Reference in New Issue