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 it's type if set, so looking for it has to be ignored. There are also some services tests that are mocking out what is eventually an rpc endpoint and those need to specifically set the target attribute to None otherwise .get() on the Mock will return another Mock and cause a failure. Change-Id: Ic12df8b12b1379f902137d49b605daaf0b89801d Closes-Bug: #1715470
This commit is contained in:
parent
5991f77cf2
commit
943be8560d
@ -118,7 +118,7 @@ class ServiceTestCase(test.NoDBTestCase):
|
||||
def test_init_and_start_hooks(self, mock_get_by_host_and_binary,
|
||||
mock_create):
|
||||
mock_get_by_host_and_binary.return_value = None
|
||||
mock_manager = mock.Mock()
|
||||
mock_manager = mock.Mock(target=None)
|
||||
serv = service.Service(self.host,
|
||||
self.binary,
|
||||
self.topic,
|
||||
@ -195,7 +195,7 @@ class ServiceTestCase(test.NoDBTestCase):
|
||||
mock_get_by_host_and_binary,
|
||||
mock_create):
|
||||
mock_get_by_host_and_binary.return_value = None
|
||||
mock_manager = mock.Mock()
|
||||
mock_manager = mock.Mock(target=None)
|
||||
serv = service.Service(self.host,
|
||||
self.binary,
|
||||
self.topic,
|
||||
@ -218,7 +218,7 @@ class ServiceTestCase(test.NoDBTestCase):
|
||||
@mock.patch('nova.objects.service.Service.get_by_host_and_binary')
|
||||
def test_parent_graceful_shutdown_with_cleanup_host(
|
||||
self, mock_svc_get_by_host_and_binary, mock_API):
|
||||
mock_manager = mock.Mock()
|
||||
mock_manager = mock.Mock(target=None)
|
||||
|
||||
serv = service.Service(self.host,
|
||||
self.binary,
|
||||
|
@ -44,8 +44,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 it's 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
|
||||
|
||||
server = rpc.get_server(messaging.Target(topic='compute',
|
||||
server=CONF.host),
|
||||
|
Loading…
Reference in New Issue
Block a user