Matthew Treinish | a33037e | 2013-12-05 23:16:39 +0000 | [diff] [blame] | 1 | # 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 Treinish | 827a6fb | 2014-03-20 19:30:08 +0000 | [diff] [blame] | 15 | import os |
| 16 | |
Doug Hellmann | 583ce2c | 2015-03-11 14:55:46 +0000 | [diff] [blame] | 17 | from oslo_concurrency import lockutils |
| 18 | from oslo_config import cfg |
| 19 | from oslo_config import fixture as conf_fixture |
Matthew Treinish | a33037e | 2013-12-05 23:16:39 +0000 | [diff] [blame] | 20 | |
Matthew Treinish | ff59848 | 2014-02-28 16:13:58 -0500 | [diff] [blame] | 21 | from tempest import config |
Matthew Treinish | a33037e | 2013-12-05 23:16:39 +0000 | [diff] [blame] | 22 | |
Matthew Treinish | a33037e | 2013-12-05 23:16:39 +0000 | [diff] [blame] | 23 | |
Matthew Treinish | ff59848 | 2014-02-28 16:13:58 -0500 | [diff] [blame] | 24 | class ConfigFixture(conf_fixture.Config): |
Matthew Treinish | a33037e | 2013-12-05 23:16:39 +0000 | [diff] [blame] | 25 | |
Matthew Treinish | ff59848 | 2014-02-28 16:13:58 -0500 | [diff] [blame] | 26 | def __init__(self): |
Johan Pas | 0ae551f | 2015-12-28 22:44:04 +0100 | [diff] [blame^] | 27 | cfg.CONF([], default_config_files=[]) |
Matthew Treinish | ff59848 | 2014-02-28 16:13:58 -0500 | [diff] [blame] | 28 | config.register_opts() |
| 29 | super(ConfigFixture, self).__init__() |
Mauro S. M. Rodrigues | dbe4cb6 | 2014-02-07 13:03:27 +0000 | [diff] [blame] | 30 | |
Matthew Treinish | ff59848 | 2014-02-28 16:13:58 -0500 | [diff] [blame] | 31 | def setUp(self): |
| 32 | super(ConfigFixture, self).setUp() |
| 33 | self.conf.set_default('build_interval', 10, group='compute') |
| 34 | self.conf.set_default('build_timeout', 10, group='compute') |
| 35 | self.conf.set_default('disable_ssl_certificate_validation', True, |
| 36 | group='identity') |
| 37 | self.conf.set_default('uri', 'http://fake_uri.com/auth', |
| 38 | group='identity') |
| 39 | self.conf.set_default('uri_v3', 'http://fake_uri_v3.com/auth', |
| 40 | group='identity') |
| 41 | self.conf.set_default('neutron', True, group='service_available') |
| 42 | self.conf.set_default('heat', True, group='service_available') |
Matthew Treinish | 827a6fb | 2014-03-20 19:30:08 +0000 | [diff] [blame] | 43 | if not os.path.exists(str(os.environ.get('OS_TEST_LOCK_PATH'))): |
| 44 | os.mkdir(str(os.environ.get('OS_TEST_LOCK_PATH'))) |
Doug Hellmann | 583ce2c | 2015-03-11 14:55:46 +0000 | [diff] [blame] | 45 | lockutils.set_defaults( |
| 46 | lock_path=str(os.environ.get('OS_TEST_LOCK_PATH')), |
| 47 | ) |
Andrea Frittoli | 7d707a5 | 2014-04-06 11:46:32 +0100 | [diff] [blame] | 48 | self.conf.set_default('auth_version', 'v2', group='identity') |
| 49 | for config_option in ['username', 'password', 'tenant_name']: |
| 50 | # Identity group items |
| 51 | for prefix in ['', 'alt_', 'admin_']: |
Matthew Treinish | 16cf1e5 | 2015-08-11 10:39:23 -0400 | [diff] [blame] | 52 | if prefix == 'admin_': |
| 53 | group = 'auth' |
| 54 | else: |
| 55 | group = 'identity' |
Andrea Frittoli | 7d707a5 | 2014-04-06 11:46:32 +0100 | [diff] [blame] | 56 | self.conf.set_default(prefix + config_option, |
| 57 | 'fake_' + config_option, |
Matthew Treinish | 16cf1e5 | 2015-08-11 10:39:23 -0400 | [diff] [blame] | 58 | group=group) |
Mauro S. M. Rodrigues | dbe4cb6 | 2014-02-07 13:03:27 +0000 | [diff] [blame] | 59 | |
Mauro S. M. Rodrigues | dbe4cb6 | 2014-02-07 13:03:27 +0000 | [diff] [blame] | 60 | |
Matthew Treinish | ff59848 | 2014-02-28 16:13:58 -0500 | [diff] [blame] | 61 | class FakePrivate(config.TempestConfigPrivate): |
Joe Gordon | 28a84ae | 2014-07-17 15:38:28 +0000 | [diff] [blame] | 62 | def __init__(self, parse_conf=True, config_path=None): |
Matthew Treinish | ff59848 | 2014-02-28 16:13:58 -0500 | [diff] [blame] | 63 | self._set_attrs() |
Johan Pas | 0ae551f | 2015-12-28 22:44:04 +0100 | [diff] [blame^] | 64 | self.lock_path = cfg.CONF.oslo_concurrency.lock_path |