Merge "Do not use system config file for test"
This commit is contained in:
commit
7d4fa41b16
@ -112,7 +112,7 @@ cfg.CONF.register_opt(COLL_OPT, 'collector')
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
def prepare_service(argv=None):
|
||||
def prepare_service(argv=None, config_files=None):
|
||||
oslo_i18n.enable_lazy()
|
||||
log.register_options(cfg.CONF)
|
||||
log_levels = (cfg.CONF.default_log_levels +
|
||||
@ -121,7 +121,8 @@ def prepare_service(argv=None):
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
cfg.CONF(argv[1:], project='ceilometer', validate_default_values=True,
|
||||
version=version.version_info.version_string())
|
||||
version=version.version_info.version_string(),
|
||||
default_config_files=config_files)
|
||||
log.setup(cfg.CONF, 'ceilometer')
|
||||
# NOTE(liusheng): guru cannot run with service under apache daemon, so when
|
||||
# ceilometer-api running with mod_wsgi, the argv is [], we don't start
|
||||
|
@ -56,7 +56,7 @@ class ConfigFixture(fixture.GabbiFixture):
|
||||
if db_url is None:
|
||||
raise case.SkipTest('No database connection configured')
|
||||
|
||||
service.prepare_service([])
|
||||
service.prepare_service(argv=[], config_files=[])
|
||||
conf = fixture_config.Config().conf
|
||||
self.conf = conf
|
||||
opts.set_defaults(self.conf)
|
||||
|
@ -199,7 +199,8 @@ class BaseRealNotification(tests_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(BaseRealNotification, self).setUp()
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
service.prepare_service([])
|
||||
# Dummy config file to avoid looking for system config
|
||||
service.prepare_service(argv=[], config_files=[])
|
||||
self.setup_messaging(self.CONF, 'nova')
|
||||
|
||||
pipeline_cfg_file = self.setup_pipeline(['instance', 'memory'])
|
||||
@ -452,7 +453,7 @@ class TestRealNotificationMultipleAgents(tests_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestRealNotificationMultipleAgents, self).setUp()
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
service.prepare_service([])
|
||||
service.prepare_service(argv=[], config_files=[])
|
||||
self.setup_messaging(self.CONF, 'nova')
|
||||
|
||||
pipeline_cfg_file = self.setup_pipeline(['instance', 'memory'])
|
||||
|
@ -53,7 +53,7 @@ class DispatcherTest(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(DispatcherTest, self).setUp()
|
||||
self.conf = self.useFixture(config_fixture.Config())
|
||||
ceilometer_service.prepare_service([])
|
||||
ceilometer_service.prepare_service(argv=[], config_files=[])
|
||||
self.conf.config(
|
||||
resources_definition_file=self.path_get(
|
||||
'etc/ceilometer/gnocchi_resources.yaml'),
|
||||
@ -330,7 +330,7 @@ class DispatcherWorkflowTest(base.BaseTestCase,
|
||||
return_value=ks_client))
|
||||
self.ks_client = ks_client
|
||||
|
||||
ceilometer_service.prepare_service([])
|
||||
ceilometer_service.prepare_service(argv=[], config_files=[])
|
||||
self.conf.config(
|
||||
resources_definition_file=self.path_get(
|
||||
'etc/ceilometer/gnocchi_resources.yaml'),
|
||||
|
@ -192,7 +192,7 @@ class TestMeterProcessing(test.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestMeterProcessing, self).setUp()
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
ceilometer_service.prepare_service([])
|
||||
ceilometer_service.prepare_service(argv=[], config_files=[])
|
||||
self.handler = notifications.ProcessMeterNotifications(mock.Mock())
|
||||
|
||||
def test_fallback_meter_path(self):
|
||||
|
@ -25,7 +25,7 @@ class TestOpencontrailClient(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestOpencontrailClient, self).setUp()
|
||||
self.conf = self.useFixture(config_fixture.Config())
|
||||
ceilometer_service.prepare_service([])
|
||||
ceilometer_service.prepare_service(argv=[], config_files=[])
|
||||
self.client = client.Client('http://127.0.0.1:8081', {'arg1': 'aaa'})
|
||||
|
||||
self.get_resp = mock.MagicMock()
|
||||
|
@ -32,7 +32,7 @@ class TestClientHTTPBasicAuth(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestClientHTTPBasicAuth, self).setUp()
|
||||
self.conf = self.useFixture(config_fixture.Config())
|
||||
ceilometer_service.prepare_service([])
|
||||
ceilometer_service.prepare_service(argv=[], config_files=[])
|
||||
self.parsed_url = urlparse.urlparse(
|
||||
'http://127.0.0.1:8080/controller/nb/v2?container_name=default&'
|
||||
'container_name=egg&auth=%s&user=admin&password=admin_pass&'
|
||||
|
Loading…
Reference in New Issue
Block a user