From 4d58dccfd58a01724a64415ff567abf359b48e1a Mon Sep 17 00:00:00 2001 From: David Ripton Date: Mon, 15 Oct 2012 13:42:32 -0400 Subject: Log CONF from ProcessLauncher.wait, like ServiceLauncher Fixes bug #1050380 In the unit tests, we need to call CONF so that the config-file option referenced by log_opt_values() is registered. We also need unregister the default_publisher_id option to workaround bug #107372. Change-Id: Icc63237ddf97aaa730c0484974ec05a3080f8f04 --- tests/unit/test_service.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests/unit/test_service.py') diff --git a/tests/unit/test_service.py b/tests/unit/test_service.py index fce6b45..59f3145 100644 --- a/tests/unit/test_service.py +++ b/tests/unit/test_service.py @@ -29,10 +29,11 @@ from eventlet import greenthread from openstack.common import cfg from openstack.common.gettextutils import _ from openstack.common import log as logging +from openstack.common.notifier import api as notifier_api from openstack.common import service from tests import utils - +CONF = cfg.CONF LOG = logging.getLogger(__name__) @@ -108,7 +109,16 @@ class ServiceLauncherTest(utils.BaseTestCase): self.assertEqual(len(workers), self.workers) return workers + def setUp(self): + super(ServiceLauncherTest, self).setUp() + # FIXME(markmc): Ugly hack to workaround bug #1073732 + CONF.unregister_opts(notifier_api.notifier_opts) + # NOTE(markmc): ConfigOpts.log_opt_values() uses CONF.config-file + CONF(args=[], default_config_files=[]) + def tearDown(self): + CONF.reset() + CONF.register_opts(notifier_api.notifier_opts) if self.pid: # Make sure all processes are stopped os.kill(self.pid, signal.SIGTERM) -- cgit