Use get_rpc_transport instead of get_transport
With the added get_rpc_transport() function in oslo.messaging [1] and the recent version bump of oslo.messaging to 5.24.2, we can safely replace get_transport() with get_rpc_transport() which is much cleaner. [1] https://review.openstack.org/#/c/454194/ Change-Id: If0b5a61abfd84d18834fcc74259f290a5640c3c9
This commit is contained in:
parent
6b75f8cc55
commit
12e0bf96ca
@ -36,8 +36,8 @@ EXTRA_EXMODS = []
|
||||
def init(conf):
|
||||
global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
|
||||
exmods = get_allowed_exmods()
|
||||
TRANSPORT = messaging.get_transport(conf,
|
||||
allowed_remote_exmods=exmods)
|
||||
TRANSPORT = messaging.get_rpc_transport(conf,
|
||||
allowed_remote_exmods=exmods)
|
||||
NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
|
||||
conf,
|
||||
allowed_remote_exmods=exmods)
|
||||
|
@ -27,15 +27,15 @@ class TestUtils(base.TestCase):
|
||||
@mock.patch.object(messaging, 'Notifier', autospec=True)
|
||||
@mock.patch.object(messaging, 'JsonPayloadSerializer', autospec=True)
|
||||
@mock.patch.object(messaging, 'get_notification_transport', autospec=True)
|
||||
@mock.patch.object(messaging, 'get_transport', autospec=True)
|
||||
def test_init_globals_notifications(self, mock_get_transport,
|
||||
@mock.patch.object(messaging, 'get_rpc_transport', autospec=True)
|
||||
def test_init_globals_notifications(self, mock_get_rpc_transport,
|
||||
mock_get_notification,
|
||||
mock_json_serializer,
|
||||
mock_notifier):
|
||||
self._test_init_globals(mock_get_transport, mock_get_notification,
|
||||
self._test_init_globals(mock_get_rpc_transport, mock_get_notification,
|
||||
mock_json_serializer, mock_notifier)
|
||||
|
||||
def _test_init_globals(self, mock_get_transport, mock_get_notification,
|
||||
def _test_init_globals(self, mock_get_rpc_transport, mock_get_notification,
|
||||
mock_json_serializer, mock_notifier):
|
||||
rpc.TRANSPORT = None
|
||||
rpc.NOTIFICATION_TRANSPORT = None
|
||||
@ -50,7 +50,7 @@ class TestUtils(base.TestCase):
|
||||
|
||||
rpc.init(CONF)
|
||||
|
||||
self.assertEqual(mock_get_transport.return_value, rpc.TRANSPORT)
|
||||
self.assertEqual(mock_get_rpc_transport.return_value, rpc.TRANSPORT)
|
||||
self.assertEqual(mock_get_notification.return_value,
|
||||
rpc.NOTIFICATION_TRANSPORT)
|
||||
self.assertTrue(mock_json_serializer.called)
|
||||
|
Loading…
Reference in New Issue
Block a user