diff --git a/aodh/service.py b/aodh/service.py index 4ef06a794..56c744264 100644 --- a/aodh/service.py +++ b/aodh/service.py @@ -91,7 +91,7 @@ CLI_OPTS = [ ] -def prepare_service(argv=None): +def prepare_service(argv=None, config_files=None): conf = cfg.ConfigOpts() oslo_i18n.enable_lazy() log.register_options(conf) @@ -106,7 +106,8 @@ def prepare_service(argv=None): conf.register_opts(list(options), group=None if group == "DEFAULT" else group) - conf(argv, project='aodh', validate_default_values=True) + conf(argv, project='aodh', validate_default_values=True, + default_config_files=config_files) log.setup(conf, 'aodh') messaging.setup() return conf diff --git a/aodh/tests/functional/api/__init__.py b/aodh/tests/functional/api/__init__.py index 62980f8ac..eb22801a8 100644 --- a/aodh/tests/functional/api/__init__.py +++ b/aodh/tests/functional/api/__init__.py @@ -35,7 +35,7 @@ class FunctionalTest(db_test_base.TestBase): def setUp(self): super(FunctionalTest, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf self.setup_messaging(self.CONF) diff --git a/aodh/tests/functional/api/test_app.py b/aodh/tests/functional/api/test_app.py index 740d3811c..da3e28d22 100644 --- a/aodh/tests/functional/api/test_app.py +++ b/aodh/tests/functional/api/test_app.py @@ -28,7 +28,7 @@ class TestApp(base.BaseTestCase): def setUp(self): super(TestApp, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf def test_api_paste_file_not_exist(self): diff --git a/aodh/tests/functional/db.py b/aodh/tests/functional/db.py index 849abe8b9..5f4df0af6 100644 --- a/aodh/tests/functional/db.py +++ b/aodh/tests/functional/db.py @@ -145,7 +145,7 @@ class TestBase(testscenarios.testcase.WithScenarios, test_base.BaseTestCase): raise testcase.TestSkipped( 'Test is not applicable for %s' % engine) - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf self.CONF.set_override('connection', self.db_url, group="database") diff --git a/aodh/tests/functional/gabbi/fixtures.py b/aodh/tests/functional/gabbi/fixtures.py index 89f7fcc1b..d4ddb6059 100644 --- a/aodh/tests/functional/gabbi/fixtures.py +++ b/aodh/tests/functional/gabbi/fixtures.py @@ -52,7 +52,7 @@ class ConfigFixture(fixture.GabbiFixture): if db_url is None: raise case.SkipTest('No database connection configured') - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) # NOTE(jd): prepare_service() is called twice: first by load_app() for # Pecan, then Pecan calls pastedeploy, which starts the app, which has # no way to pass the conf object so that Paste apps calls again diff --git a/aodh/tests/functional/storage/test_get_connection.py b/aodh/tests/functional/storage/test_get_connection.py index 10ad2f2db..0bab3c565 100644 --- a/aodh/tests/functional/storage/test_get_connection.py +++ b/aodh/tests/functional/storage/test_get_connection.py @@ -30,7 +30,7 @@ import six class EngineTest(base.BaseTestCase): def setUp(self): super(EngineTest, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf def test_get_connection(self): @@ -52,7 +52,7 @@ class EngineTest(base.BaseTestCase): class ConnectionRetryTest(base.BaseTestCase): def setUp(self): super(ConnectionRetryTest, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf def test_retries(self): @@ -81,7 +81,7 @@ class ConnectionRetryTest(base.BaseTestCase): class ConnectionConfigTest(base.BaseTestCase): def setUp(self): super(ConnectionConfigTest, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf def test_only_default_url(self): diff --git a/aodh/tests/unit/evaluator/base.py b/aodh/tests/unit/evaluator/base.py index 8910a7907..46c1311eb 100644 --- a/aodh/tests/unit/evaluator/base.py +++ b/aodh/tests/unit/evaluator/base.py @@ -24,7 +24,7 @@ from aodh import service class TestEvaluatorBase(base.BaseTestCase): def setUp(self): super(TestEvaluatorBase, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.conf = self.useFixture(fixture.Config(conf)).conf self.api_client = mock.Mock() self.useFixture(mockpatch.Patch('ceilometerclient.client.get_client', diff --git a/aodh/tests/unit/test_coordination.py b/aodh/tests/unit/test_coordination.py index 4f472dd96..6d2696e59 100644 --- a/aodh/tests/unit/test_coordination.py +++ b/aodh/tests/unit/test_coordination.py @@ -109,7 +109,7 @@ class TestPartitioning(base.BaseTestCase): def setUp(self): super(TestPartitioning, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf self.shared_storage = {} diff --git a/aodh/tests/unit/test_evaluator.py b/aodh/tests/unit/test_evaluator.py index 8a7fbe318..3a8a3d84c 100644 --- a/aodh/tests/unit/test_evaluator.py +++ b/aodh/tests/unit/test_evaluator.py @@ -26,7 +26,7 @@ from aodh.tests import base as tests_base class TestAlarmEvaluationService(tests_base.BaseTestCase): def setUp(self): super(TestAlarmEvaluationService, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf self.setup_messaging(self.CONF) diff --git a/aodh/tests/unit/test_event.py b/aodh/tests/unit/test_event.py index fd111925c..4ce2a46ed 100644 --- a/aodh/tests/unit/test_event.py +++ b/aodh/tests/unit/test_event.py @@ -28,7 +28,7 @@ class TestEventAlarmEvaluationService(tests_base.BaseTestCase): def setUp(self): super(TestEventAlarmEvaluationService, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf self.storage_conn = mock.MagicMock() self.setup_messaging(self.CONF) diff --git a/aodh/tests/unit/test_notifier.py b/aodh/tests/unit/test_notifier.py index 2f78073e8..6dc972a84 100644 --- a/aodh/tests/unit/test_notifier.py +++ b/aodh/tests/unit/test_notifier.py @@ -45,7 +45,7 @@ class TestAlarmNotifier(tests_base.BaseTestCase): def setUp(self): super(TestAlarmNotifier, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf self.setup_messaging(self.CONF) self.service = notifier.AlarmNotifierService(self.CONF) diff --git a/aodh/tests/unit/test_rpc.py b/aodh/tests/unit/test_rpc.py index fd7c8004d..627c1d3ca 100644 --- a/aodh/tests/unit/test_rpc.py +++ b/aodh/tests/unit/test_rpc.py @@ -47,7 +47,7 @@ class FakeNotifier(object): class TestRPCAlarmNotifier(tests_base.BaseTestCase): def setUp(self): super(TestRPCAlarmNotifier, self).setUp() - conf = service.prepare_service([]) + conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf self.setup_messaging(self.CONF)