Merge "Do not use system config file for test"

This commit is contained in:
Jenkins 2015-11-09 20:51:48 +00:00 committed by Gerrit Code Review
commit 64e46b5840
12 changed files with 16 additions and 15 deletions

View File

@ -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

View File

@ -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)

View File

@ -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):

View File

@ -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")

View File

@ -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

View File

@ -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):

View File

@ -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',

View File

@ -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 = {}

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)