From 2dd5393167119c043ae125fead9f8ed9ba84241d Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 8 Jan 2019 15:39:58 +0000 Subject: Use os-cloud instead of OS env vars for functional tests In order to support switching auth contexts, such as for registered_limits which take a system scoped token, switch the functional tests to using the --os-cloud command line parameter. However, honor the OS_CLOUD env var as a way that someone can select a different cloud, including 'envvars', to use. Use devstack-system-admin cloud for limit tests Keystone requires these to have system scope now. Change-Id: Ia81eebd3e00ae986cf3ba7e3d98f3e8a1647b622 --- openstackclient/tests/functional/base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'openstackclient/tests/functional/base.py') diff --git a/openstackclient/tests/functional/base.py b/openstackclient/tests/functional/base.py index 90bbc24d..7705c655 100644 --- a/openstackclient/tests/functional/base.py +++ b/openstackclient/tests/functional/base.py @@ -24,6 +24,7 @@ COMMON_DIR = os.path.dirname(os.path.abspath(__file__)) FUNCTIONAL_DIR = os.path.normpath(os.path.join(COMMON_DIR, '..')) ROOT_DIR = os.path.normpath(os.path.join(FUNCTIONAL_DIR, '..')) EXAMPLE_DIR = os.path.join(ROOT_DIR, 'examples') +ADMIN_CLOUD = os.environ.get('OS_ADMIN_CLOUD', 'devstack-admin') def execute(cmd, fail_ok=False, merge_stderr=False): @@ -59,9 +60,11 @@ class TestCase(testtools.TestCase): delimiter_line = re.compile('^\+\-[\+\-]+\-\+$') @classmethod - def openstack(cls, cmd, fail_ok=False): + def openstack(cls, cmd, cloud=ADMIN_CLOUD, fail_ok=False): """Executes openstackclient command for the given action.""" - return execute('openstack ' + cmd, fail_ok=fail_ok) + return execute( + 'openstack --os-cloud={cloud} '.format(cloud=cloud) + + cmd, fail_ok=fail_ok) @classmethod def get_openstack_configuration_value(cls, configuration): -- cgit v1.2.1