Add import for publisher_rpc option
If this option is not imported a NoSuchOptError is raised starting the ceilometer-collector service Closes-Bug: #1258650 Change-Id: I46f8a0510603d31ce8cc9a0b5b15880083138487
This commit is contained in:
parent
ec06be3c6a
commit
5472a1dba0
@ -40,6 +40,8 @@ OPTS = [
|
|||||||
|
|
||||||
cfg.CONF.register_opts(OPTS, group="collector")
|
cfg.CONF.register_opts(OPTS, group="collector")
|
||||||
cfg.CONF.import_opt('rpc_backend', 'ceilometer.openstack.common.rpc')
|
cfg.CONF.import_opt('rpc_backend', 'ceilometer.openstack.common.rpc')
|
||||||
|
cfg.CONF.import_opt('metering_topic', 'ceilometer.publisher.rpc',
|
||||||
|
group="publisher_rpc")
|
||||||
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -29,6 +29,11 @@ from ceilometer import sample
|
|||||||
from ceilometer.tests import base as tests_base
|
from ceilometer.tests import base as tests_base
|
||||||
|
|
||||||
|
|
||||||
|
class FakeConnection():
|
||||||
|
def create_worker(self, topic, proxy, pool_name):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TestCollector(tests_base.BaseTestCase):
|
class TestCollector(tests_base.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCollector, self).setUp()
|
super(TestCollector, self).setUp()
|
||||||
@ -161,3 +166,14 @@ class TestCollector(tests_base.BaseTestCase):
|
|||||||
self.CONF.set_override('udp_address', '', group='collector')
|
self.CONF.set_override('udp_address', '', group='collector')
|
||||||
with patch('ceilometer.openstack.common.rpc.create_connection'):
|
with patch('ceilometer.openstack.common.rpc.create_connection'):
|
||||||
self.srv.start()
|
self.srv.start()
|
||||||
|
|
||||||
|
@patch.object(FakeConnection, 'create_worker')
|
||||||
|
@patch('ceilometer.openstack.common.rpc.dispatcher.RpcDispatcher')
|
||||||
|
def test_initialize_service_hook_conf_opt(self, mock_dispatcher,
|
||||||
|
mock_worker):
|
||||||
|
self.CONF.set_override('metering_topic', 'mytopic',
|
||||||
|
group='publisher_rpc')
|
||||||
|
self.srv.conn = FakeConnection()
|
||||||
|
self.srv.initialize_service_hook(mock.MagicMock())
|
||||||
|
mock_worker.assert_called_once_with('mytopic', mock_dispatcher(),
|
||||||
|
'ceilometer.collector.mytopic')
|
||||||
|
Loading…
Reference in New Issue
Block a user