Merge "NOTIFICATION_TRANSPORT should be global"
This commit is contained in:
commit
3559f15152
@ -43,7 +43,7 @@ TRANSPORT_ALIASES = {
|
|||||||
|
|
||||||
|
|
||||||
def init(conf):
|
def init(conf):
|
||||||
global TRANSPORT, NOTIFIER
|
global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
|
||||||
exmods = get_allowed_exmods()
|
exmods = get_allowed_exmods()
|
||||||
TRANSPORT = messaging.get_transport(conf,
|
TRANSPORT = messaging.get_transport(conf,
|
||||||
allowed_remote_exmods=exmods,
|
allowed_remote_exmods=exmods,
|
||||||
|
@ -11,11 +11,34 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo_config import cfg
|
||||||
|
import oslo_messaging as messaging
|
||||||
|
|
||||||
from ironic.common import context as ironic_context
|
from ironic.common import context as ironic_context
|
||||||
from ironic.common import rpc
|
from ironic.common import rpc
|
||||||
from ironic.tests import base
|
from ironic.tests import base
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
|
||||||
|
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(self, mock_get_transport, mock_get_notification,
|
||||||
|
mock_serializer, mock_notifier):
|
||||||
|
rpc.TRANSPORT = None
|
||||||
|
rpc.NOTIFICATION_TRANSPORT = None
|
||||||
|
rpc.NOTIFIER = None
|
||||||
|
rpc.init(CONF)
|
||||||
|
self.assertEqual(mock_get_transport.return_value, rpc.TRANSPORT)
|
||||||
|
self.assertEqual(mock_get_notification.return_value,
|
||||||
|
rpc.NOTIFICATION_TRANSPORT)
|
||||||
|
self.assertTrue(mock_serializer.called)
|
||||||
|
self.assertEqual(mock_notifier.return_value, rpc.NOTIFIER)
|
||||||
|
|
||||||
|
|
||||||
class TestRequestContextSerializer(base.TestCase):
|
class TestRequestContextSerializer(base.TestCase):
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
features:
|
features:
|
||||||
- It is now possible to configure the notifications tu use a different
|
- It is now possible to configure the notifications to use a different
|
||||||
transport URL than the RPCs. These could potentially be completely
|
transport URL than the RPCs. These could potentially be completely
|
||||||
different message broker hosts (though they don't need to be). If the
|
different message broker hosts (though they don't need to be). If the
|
||||||
notification-specific configuration is not provided, the notifier will use
|
notification-specific configuration is not provided, the notifier will use
|
||||||
|
Loading…
Reference in New Issue
Block a user