Merge "Fix test_rpc_consumer_isolation for oslo.messaging 5.31.0"

This commit is contained in:
Jenkins
2017-09-07 13:41:03 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 5 deletions

View File

@@ -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,

View File

@@ -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),