diff --git a/aodh/event.py b/aodh/event.py index 40dacf158..190913c0d 100644 --- a/aodh/event.py +++ b/aodh/event.py @@ -53,9 +53,9 @@ class EventAlarmEvaluationService(service.Service): def start(self): super(EventAlarmEvaluationService, self).start() self.listener = messaging.get_notification_listener( - messaging.get_transport(), - oslo_messaging.Target(topic=self.conf.event_alarm_topic), - EventAlarmEndpoint(self.evaluator)) + messaging.get_transport(self.conf), + [oslo_messaging.Target(topic=self.conf.event_alarm_topic)], + [EventAlarmEndpoint(self.evaluator)]) self.listener.start() # Add a dummy thread to have wait() working self.tg.add_timer(604800, lambda: None) diff --git a/aodh/tests/test_event.py b/aodh/tests/test_event.py index a642637ae..fd111925c 100644 --- a/aodh/tests/test_event.py +++ b/aodh/tests/test_event.py @@ -16,6 +16,7 @@ import mock from oslo_config import fixture as fixture_config +from oslo_messaging import server from aodh import event from aodh import service @@ -35,7 +36,13 @@ class TestEventAlarmEvaluationService(tests_base.BaseTestCase): return_value=self.storage_conn): self.service = event.EventAlarmEvaluationService(self.CONF) - def test_start_service(self): + def test_start_and_stop_service(self): + self.service.start() + self.assertIsInstance(self.service.listener, + server.MessageHandlingServer) + self.service.stop() + + def test_listener_start_called(self): listener = mock.Mock() with mock.patch('aodh.messaging.get_notification_listener', return_value=listener):