add more test cases to improve the test code coverage #3

In this patch, the following module test coverage improved to 100%

ceilometer/agent.py

Change-Id: I06ac05d8b3e77f67e0f25df08db25ddcb1f087ac
This commit is contained in:
Tong Li 2013-09-25 11:07:31 -04:00 committed by Gerrit Code Review
parent d280925aa0
commit 66ea203e2f

View File

@ -28,6 +28,7 @@ from stevedore.tests import manager as extension_tests
from ceilometer import sample
from ceilometer import pipeline
from ceilometer import agent
from ceilometer.tests import base
from ceilometer import transformer
@ -246,6 +247,13 @@ class BaseAgentManagerTestCase(base.TestCase):
pub = self.mgr.pipeline_manager.pipelines[0].publishers[0]
self.assertEqual(len(pub.samples), 0)
def test_agent_manager_initialize_service_hook(self):
mgr = agent.AgentManager(self.mgr.pollster_manager)
mgr.create_polling_task = mock.MagicMock()
service = mock.MagicMock()
mgr.initialize_service_hook(service)
self.assertTrue(service.tg.add_timer.called)
def test_manager_exception_persistency(self):
self.pipeline_cfg.append({
'name': "test_pipeline",