Don't keep a single global TRANSPORT object

To keep the global state of messaging like the old olso-incubator
library does, we have created a global TRANSPORT object.

But since the test use the fake:// driver of oslo.messaging in tests,
this transport is shared between tests, but some tests use 'fake://',
other the default one, and someother disable the transport.

This change ensures that a different transport is used for
code tests.

Change-Id: I22317527cc4fb44ea1fb9642586e8cdcbc97030b
This commit is contained in:
Mehdi Abaakouk
2014-06-12 15:02:56 +02:00
parent 3efe03b60a
commit 253d99026e
21 changed files with 175 additions and 170 deletions

View File

@@ -139,8 +139,9 @@ class PartitionedAlarmService(AlarmService, os_service.Service):
def __init__(self):
super(PartitionedAlarmService, self).__init__()
transport = messaging.get_transport()
self.rpc_server = messaging.get_rpc_server(
cfg.CONF.alarm.partition_rpc_topic, self)
transport, cfg.CONF.alarm.partition_rpc_topic, self)
self._load_evaluators()
self.api_client = None
@@ -193,8 +194,9 @@ class AlarmNotifierService(os_service.Service):
def __init__(self):
super(AlarmNotifierService, self).__init__()
transport = messaging.get_transport()
self.rpc_server = messaging.get_rpc_server(
cfg.CONF.alarm.notifier_rpc_topic, self)
transport, cfg.CONF.alarm.notifier_rpc_topic, self)
self.notifiers = extension.ExtensionManager(self.EXTENSIONS_NAMESPACE,
invoke_on_load=True)