Fix unit tests with oslo_messaging 5.32.0

The 5.32.0 release of oslo_messaging included the following change to the
Fake driver:

https://git.openstack.org/cgit/openstack/oslo.messaging/commit/?id=d1dac1c11d357aa8391de7e62f4d003eb820948d

Which means that FakeExchanges are now shared between all
FakeExchangeManager instances. This broke the unit tests in Heat.

This patch effectively reverts the change in oslo_messaging by isolating
FakeExchanges to individual FakeExchangeManger instances once more.

Change-Id: I6c53f477b17247958be7bd6056136bc9f7f50865
Closes-Bug: #1718780
This commit is contained in:
Zane Bitter 2017-09-21 17:00:56 -04:00
parent 127aaef196
commit 63f6a71071
1 changed files with 5 additions and 0 deletions

View File

@ -105,6 +105,11 @@ def setup(url=None, optional=False):
eventlet.monkey_patch(time=True)
if not TRANSPORT or not NOTIFICATIONS_TRANSPORT:
setup_transports(url, optional)
# In the fake driver, make the dict of exchanges local to each exchange
# manager, instead of using the shared class attribute. Doing otherwise
# breaks the unit tests.
if url and url.startswith("fake://"):
TRANSPORT._driver._exchange_manager._exchanges = {}
if not NOTIFIER and NOTIFICATIONS_TRANSPORT:
serializer = RequestContextSerializer(JsonPayloadSerializer())