Support identity_version in credential provider wrappers
Add identity_version to get_client_manager and get_isolated_credentials.
Most tests rely on the configured version, which is the default if not
specified, but identity test need to force this to v2 or v3.
Change-Id: I69e07237c49e13bc1fd506e9decbbb27840a733b
Partially-implements: bp/multi-keystone-api-version-tests
diff --git a/tempest/common/credentials.py b/tempest/common/credentials.py
index 2f7fb73..1ca0128 100644
--- a/tempest/common/credentials.py
+++ b/tempest/common/credentials.py
@@ -26,7 +26,8 @@
# Dropping interface and password, as they are never used anyways
# TODO(andreaf) Drop them from the CredentialsProvider interface completely
def get_isolated_credentials(name, network_resources=None,
- force_tenant_isolation=False):
+ force_tenant_isolation=False,
+ identity_version=None):
# If a test requires a new account to work, it can have it via forcing
# tenant isolation. A new account will be produced only for that test.
# In case admin credentials are not available for the account creation,
@@ -34,13 +35,16 @@
if CONF.auth.allow_tenant_isolation or force_tenant_isolation:
return isolated_creds.IsolatedCreds(
name=name,
- network_resources=network_resources)
+ network_resources=network_resources,
+ identity_version=identity_version)
else:
if CONF.auth.locking_credentials_provider:
# Most params are not relevant for pre-created accounts
- return accounts.Accounts(name=name)
+ return accounts.Accounts(name=name,
+ identity_version=identity_version)
else:
- return accounts.NotLockingAccounts(name=name)
+ return accounts.NotLockingAccounts(
+ name=name, identity_version=identity_version)
# We want a helper function here to check and see if admin credentials
diff --git a/tempest/test.py b/tempest/test.py
index 7039f4c..19bae74 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -378,17 +378,19 @@
level=None))
@classmethod
- def get_client_manager(cls):
+ def get_client_manager(cls, identity_version=None):
"""
Returns an OpenStack client manager
"""
force_tenant_isolation = getattr(cls, 'force_tenant_isolation', None)
+ identity_version = identity_version or CONF.identity.auth_version
if (not hasattr(cls, 'isolated_creds') or
not cls.isolated_creds.name == cls.__name__):
cls.isolated_creds = credentials.get_isolated_credentials(
name=cls.__name__, network_resources=cls.network_resources,
force_tenant_isolation=force_tenant_isolation,
+ identity_version=identity_version
)
creds = cls.isolated_creds.get_primary_creds()