blob: ca8bc3e38d7e6b7784e1fbf1639dc2a74a512bb1 [file] [log] [blame]
Matthew Treinisha33037e2013-12-05 23:16:39 +00001# Copyright 2013 IBM Corp.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
Matthew Treinish827a6fb2014-03-20 19:30:08 +000015import os
16
Doug Hellmann583ce2c2015-03-11 14:55:46 +000017from oslo_concurrency import lockutils
18from oslo_config import cfg
19from oslo_config import fixture as conf_fixture
Matthew Treinisha33037e2013-12-05 23:16:39 +000020
Matthew Treinishff598482014-02-28 16:13:58 -050021from tempest import config
Matthew Treinisha33037e2013-12-05 23:16:39 +000022
Matthew Treinisha33037e2013-12-05 23:16:39 +000023
Matthew Treinishff598482014-02-28 16:13:58 -050024class ConfigFixture(conf_fixture.Config):
Matthew Treinisha33037e2013-12-05 23:16:39 +000025
Matthew Treinishff598482014-02-28 16:13:58 -050026 def __init__(self):
27 config.register_opts()
28 super(ConfigFixture, self).__init__()
Mauro S. M. Rodriguesdbe4cb62014-02-07 13:03:27 +000029
Matthew Treinishff598482014-02-28 16:13:58 -050030 def setUp(self):
31 super(ConfigFixture, self).setUp()
32 self.conf.set_default('build_interval', 10, group='compute')
33 self.conf.set_default('build_timeout', 10, group='compute')
34 self.conf.set_default('disable_ssl_certificate_validation', True,
35 group='identity')
36 self.conf.set_default('uri', 'http://fake_uri.com/auth',
37 group='identity')
38 self.conf.set_default('uri_v3', 'http://fake_uri_v3.com/auth',
39 group='identity')
40 self.conf.set_default('neutron', True, group='service_available')
41 self.conf.set_default('heat', True, group='service_available')
Matthew Treinish827a6fb2014-03-20 19:30:08 +000042 if not os.path.exists(str(os.environ.get('OS_TEST_LOCK_PATH'))):
43 os.mkdir(str(os.environ.get('OS_TEST_LOCK_PATH')))
Doug Hellmann583ce2c2015-03-11 14:55:46 +000044 lockutils.set_defaults(
45 lock_path=str(os.environ.get('OS_TEST_LOCK_PATH')),
46 )
Andrea Frittoli7d707a52014-04-06 11:46:32 +010047 self.conf.set_default('auth_version', 'v2', group='identity')
48 for config_option in ['username', 'password', 'tenant_name']:
49 # Identity group items
50 for prefix in ['', 'alt_', 'admin_']:
Matthew Treinish16cf1e52015-08-11 10:39:23 -040051 if prefix == 'admin_':
52 group = 'auth'
53 else:
54 group = 'identity'
Andrea Frittoli7d707a52014-04-06 11:46:32 +010055 self.conf.set_default(prefix + config_option,
56 'fake_' + config_option,
Matthew Treinish16cf1e52015-08-11 10:39:23 -040057 group=group)
Mauro S. M. Rodriguesdbe4cb62014-02-07 13:03:27 +000058
Mauro S. M. Rodriguesdbe4cb62014-02-07 13:03:27 +000059
Matthew Treinishff598482014-02-28 16:13:58 -050060class FakePrivate(config.TempestConfigPrivate):
Joe Gordon28a84ae2014-07-17 15:38:28 +000061 def __init__(self, parse_conf=True, config_path=None):
Matthew Treinishff598482014-02-28 16:13:58 -050062 cfg.CONF([], default_config_files=[])
63 self._set_attrs()
Matthew Treinishc791ac42014-07-16 09:15:23 -040064 self.lock_path = cfg.CONF.lock_path