Fix test_rpc_consumer_isolation for oslo.messaging 5.31.0

With this change in oslo.messaging 5.31.0:

  I0bbf9fca0ecbe71efa87c9613ffd32eb718f2c0e

the endpoint passed in is going to be checked for a 'target'
attribute and check its type if set, so looking for it has
to be ignored.

Change-Id: Ib268d48f1b4affd979d7542f41af07f48141addc
Closes-Bug: #1715470
This commit is contained in:
Tom Barron 2017-09-08 16:22:45 -04:00
parent 4796e49560
commit 74dea186bb
1 changed files with 7 additions and 2 deletions

View File

@ -36,8 +36,13 @@ class IsolationTestCase(test.TestCase):
def test_rpc_consumer_isolation(self):
class NeverCalled(object):
def __getattribute__(*args):
assert False, "I should never get called."
def __getattribute__(self, name):
if name == 'target':
# oslo.messaging 5.31.0 explicitly looks for 'target'
# on the endpoint and checks its type, so we can't avoid
# it here. Just ignore it if that's the case.
return
assert False, "I should never get called - name: %s" % name
target = messaging.Target(topic='share', server=cfg.CONF.host)
server = rpc.get_server(target=target, endpoints=[NeverCalled()])