Fix clearing of the fake RPC Exchange
The current fake driver does not properly clean up the fake RPC exchange between tests. This means that if a test invokes code that makes an RPC request, using the fake driver, without consuming the RPC message, then another test may receive this request making it fail. This issues has been found while working on a Cinder patch and has been worked-arounded there with Change-Id I52ee4b345b0a4b262e330a9a89552cd216eafdbe. This patch fixes the source of the problem by clearing the exchange class dictionary in the FakeExchangeManager during the FakeDriver cleanup. Change-Id: If82c2175cf7242b80509d180cdf92323c0f4c43b
This commit is contained in:
parent
8e3c523fd7
commit
f65607fa48
@ -158,6 +158,10 @@ class FakeExchangeManager(object):
|
||||
with self._exchanges_lock:
|
||||
return self._exchanges.setdefault(name, FakeExchange(name))
|
||||
|
||||
@classmethod
|
||||
def cleanup(cls):
|
||||
cls._exchanges.clear()
|
||||
|
||||
|
||||
class FakeDriver(base.BaseDriver):
|
||||
"""Fake driver used for testing.
|
||||
@ -253,4 +257,4 @@ class FakeDriver(base.BaseDriver):
|
||||
batch_timeout)
|
||||
|
||||
def cleanup(self):
|
||||
pass
|
||||
self._exchange_manager.cleanup()
|
||||
|
Loading…
Reference in New Issue
Block a user