diff options
author | Steve Heyman <steve.heyman@rackspace.com> | 2015-05-06 14:17:24 -0500 |
---|---|---|
committer | Steve Heyman <steve.heyman@rackspace.com> | 2015-05-20 16:43:38 -0500 |
commit | 3d4caafc71cfde2ddf41e033a0f412346c7b4a95 (patch) | |
tree | 256dc541f7b286d56b94680f2fcce863d45e50f7 | |
parent | f67ae704012ec49bb937131b2c3dd7e467e055a4 (diff) | |
download | python-barbicanclient-3d4caafc71cfde2ddf41e033a0f412346c7b4a95.tar.gz |
Remove tempest config dependency in functional tests
Replaced tempest config with oslo config for the functional tests.
Change-Id: If12afb7aa648686b07900fadc016246fbd8d28e9
-rw-r--r-- | functionaltests/__init__.py | 29 | ||||
-rw-r--r-- | functionaltests/base.py | 8 | ||||
-rw-r--r-- | functionaltests/cli/v1/behaviors/base_behaviors.py | 4 | ||||
-rw-r--r-- | functionaltests/client/base.py | 4 | ||||
-rw-r--r-- | functionaltests/client/test_client_connectivity.py | 4 | ||||
-rw-r--r-- | functionaltests/common/__init__.py | 0 | ||||
-rw-r--r-- | functionaltests/common/config.py | 80 | ||||
-rwxr-xr-x | functionaltests/run_tests.sh | 6 |
8 files changed, 90 insertions, 45 deletions
diff --git a/functionaltests/__init__.py b/functionaltests/__init__.py index cdcb965..42d6f6f 100644 --- a/functionaltests/__init__.py +++ b/functionaltests/__init__.py @@ -13,33 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ -import os -from oslo.config import cfg -from tempest import config +from functionaltests.common import config -CONF = config.CONF - - -def _get_conf_file_path(): - functional_dir = os.path.split(os.path.abspath(__file__))[0] - base_dir = os.path.split(functional_dir)[0] - return os.path.join(base_dir, 'etc', 'functional_tests.conf') - - -# Use local tempest conf if one is available. -conf_file = _get_conf_file_path() -if os.path.exists(conf_file): - CONF.set_config_path(conf_file) - - -CONF.register_group(cfg.OptGroup('keymanager')) -CONF.register_opt(cfg.StrOpt('url'), group='keymanager') -CONF.register_opt(cfg.StrOpt('username'), group='keymanager') -CONF.register_opt(cfg.StrOpt('password'), group='keymanager') -CONF.register_opt(cfg.StrOpt('project_name'), group='keymanager') -CONF.register_opt(cfg.StrOpt('project_id'), group='keymanager') -CONF.register_opt(cfg.IntOpt('max_payload_size', default=10000), - group='keymanager') -CONF.register_opt(cfg.StrOpt('project_domain_name'), group='keymanager') +CONF = config.get_config() diff --git a/functionaltests/base.py b/functionaltests/base.py index 9df8576..8bd75a8 100644 --- a/functionaltests/base.py +++ b/functionaltests/base.py @@ -14,15 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. """ import logging -import os +from functionaltests.common import config import oslotest.base as oslotest -from barbicanclient import client -from keystoneclient.auth import identity -from keystoneclient import session -from tempest import config -CONF = config.CONF +CONF = config.get_config() class BaseTestCase(oslotest.BaseTestCase): diff --git a/functionaltests/cli/v1/behaviors/base_behaviors.py b/functionaltests/cli/v1/behaviors/base_behaviors.py index 3514e6c..a4e75fa 100644 --- a/functionaltests/cli/v1/behaviors/base_behaviors.py +++ b/functionaltests/cli/v1/behaviors/base_behaviors.py @@ -19,9 +19,9 @@ import re import six from barbicanclient import barbican -from tempest import config +from functionaltests.common import config -CONF = config.CONF +CONF = config.get_config() class BaseBehaviors(object): diff --git a/functionaltests/client/base.py b/functionaltests/client/base.py index ace11bf..3eb3cb6 100644 --- a/functionaltests/client/base.py +++ b/functionaltests/client/base.py @@ -16,12 +16,12 @@ limitations under the License. import logging from functionaltests.base import BaseTestCase +from functionaltests.common import config from barbicanclient import client from keystoneclient.auth import identity from keystoneclient import session -from tempest import config -CONF = config.CONF +CONF = config.get_config() class TestCase(BaseTestCase): diff --git a/functionaltests/client/test_client_connectivity.py b/functionaltests/client/test_client_connectivity.py index 31d5e12..2c23092 100644 --- a/functionaltests/client/test_client_connectivity.py +++ b/functionaltests/client/test_client_connectivity.py @@ -15,12 +15,12 @@ import logging from functionaltests.base import BaseTestCase +from functionaltests.common import config from barbicanclient import client from keystoneclient.auth import identity from keystoneclient import session -from tempest import config -CONF = config.CONF +CONF = config.get_config() class WhenTestingClientConnectivity(BaseTestCase): diff --git a/functionaltests/common/__init__.py b/functionaltests/common/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/functionaltests/common/__init__.py diff --git a/functionaltests/common/config.py b/functionaltests/common/config.py new file mode 100644 index 0000000..de64634 --- /dev/null +++ b/functionaltests/common/config.py @@ -0,0 +1,80 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +import os + +from oslo_config import cfg + +TEST_CONF = None + + +def setup_config(config_file=''): + global TEST_CONF + TEST_CONF = cfg.ConfigOpts() + + identity_group = cfg.OptGroup(name='identity') + identity_options = [ + cfg.StrOpt('uri', default='http://localhost:5000/v2.0'), + cfg.StrOpt('uri_v3', default='http://localhost:5000/v3'), + cfg.StrOpt('auth_version', default='v3'), + cfg.StrOpt('username', default='admin'), + cfg.StrOpt('password', default='secretadmin'), + cfg.StrOpt('tenant_name', default='admin'), + cfg.StrOpt('domain_name', default='Default'), + cfg.StrOpt('admin_username', default='admin'), + cfg.StrOpt('admin_password', default='secretadmin'), + cfg.StrOpt('admin_tenant_name', default='admin'), + cfg.StrOpt('admin_domain_name', default='Default') + ] + TEST_CONF.register_group(identity_group) + TEST_CONF.register_opts(identity_options, group=identity_group) + + keymanager_group = cfg.OptGroup(name='keymanager') + keymanager_options = [ + cfg.StrOpt('url', default='http://localhost:9311'), + cfg.StrOpt('username', default='admin'), + cfg.StrOpt('password', default='secretadmin'), + cfg.StrOpt('project_name', default='admin'), + cfg.StrOpt('project_id', default='admin'), + cfg.StrOpt('project_domain_name', default='Default'), + cfg.IntOpt('max_payload_size', default=10000) + ] + TEST_CONF.register_group(keymanager_group) + TEST_CONF.register_opts(keymanager_options, group=keymanager_group) + + # Figure out which config to load + config_to_load = [] + local_config = './etc/functional_tests.conf' + devstack_config = '../etc/functional_tests.conf' + if os.path.isfile(config_file): + config_to_load.append(config_file) + elif os.path.isfile(local_config): + config_to_load.append(local_config) + elif os.path.isfile(devstack_config): + config_to_load.append(devstack_config) + else: + config_to_load.append('/etc/functional_tests.conf') + + # Actually parse config + TEST_CONF( + (), # Required to load a anonymous config + default_config_files=config_to_load + ) + + +def get_config(): + if not TEST_CONF: + setup_config() + return TEST_CONF diff --git a/functionaltests/run_tests.sh b/functionaltests/run_tests.sh index 6e53ab3..214d0b1 100755 --- a/functionaltests/run_tests.sh +++ b/functionaltests/run_tests.sh @@ -11,12 +11,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -# Where tempest code lives - -TEMPEST_DIR=${TEMPEST_DIR:-/opt/stack/new/tempest} - -# Install tempest -pip install -e $TEMPEST_DIR # Install test-requirements pip install -r /opt/stack/new/python-barbicanclient/test-requirements.txt |