Merge "Sets storage_conn in CollectorService."

This commit is contained in:
Jenkins 2013-07-24 17:33:16 +00:00 committed by Gerrit Code Review
commit a4b1b54a48
2 changed files with 10 additions and 0 deletions

View File

@ -114,6 +114,7 @@ class CollectorService(rpc_service.Service):
def __init__(self, host, topic, manager=None):
super(CollectorService, self).__init__(host, topic, manager)
self.storage_conn = storage.get_connection(cfg.CONF)
def start(self):
super(CollectorService, self).start()

View File

@ -127,6 +127,10 @@ class TestUDPCollectorService(TestCollector):
resource_metadata={},
)._asdict())
def test_service_has_storage_conn(self):
srv = service.UDPCollectorService()
self.assertIsNotNone(srv.storage_conn)
def test_udp_receive(self):
self.srv.storage_conn = self.mox.CreateMock(base.Connection)
self.counter['source'] = 'mysource'
@ -175,6 +179,11 @@ class TestCollectorService(TestCollector):
self.srv = service.CollectorService('the-host', 'the-topic')
self.ctx = None
def test_service_has_storage_conn(self):
# Test an unmocked default CollectorService
srv = service.CollectorService('the-host', 'the-topic')
self.assertIsNotNone(srv.storage_conn)
@patch('ceilometer.pipeline.setup_pipeline', MagicMock())
def test_init_host(self):
# If we try to create a real RPC connection, init_host() never