Move identity_version to class level
Rather than having to setup the client manager by passing the identity
version, read the identity version from a class level attribute, so
that the identity version can be overwritten from there by the
identity tests.
Change-Id: Ibc6e6289c349e7b5caf0fea2d0485c8cc4b9c32a
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 5d66b9c..878ff6d 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -66,16 +66,9 @@
credentials = ['primary']
- @classmethod
- def setup_credentials(cls):
- super(BaseIdentityV2Test, cls).setup_credentials()
- cls.os = cls.get_client_manager(identity_version='v2')
-
- @classmethod
- def skip_checks(cls):
- super(BaseIdentityV2Test, cls).skip_checks()
- if not CONF.identity_feature_enabled.api_v2:
- raise cls.skipException("Identity api v2 is not enabled")
+ # identity v2 tests should obtain tokens and create accounts via v2
+ # regardless of the configured CONF.identity.auth_version
+ identity_version = 'v2'
@classmethod
def setup_clients(cls):
@@ -94,7 +87,7 @@
class BaseIdentityV2AdminTest(BaseIdentityV2Test):
- credentials = ['admin']
+ credentials = ['primary', 'admin']
@classmethod
def setup_clients(cls):
@@ -117,16 +110,9 @@
credentials = ['primary']
- @classmethod
- def setup_credentials(cls):
- super(BaseIdentityV3Test, cls).setup_credentials()
- cls.os = cls.get_client_manager(identity_version='v3')
-
- @classmethod
- def skip_checks(cls):
- super(BaseIdentityV3Test, cls).skip_checks()
- if not CONF.identity_feature_enabled.api_v3:
- raise cls.skipException("Identity api v3 is not enabled")
+ # identity v3 tests should obtain tokens and create accounts via v3
+ # regardless of the configured CONF.identity.auth_version
+ identity_version = 'v3'
@classmethod
def setup_clients(cls):
@@ -146,7 +132,7 @@
class BaseIdentityV3AdminTest(BaseIdentityV3Test):
- credentials = ['admin']
+ credentials = ['primary', 'admin']
@classmethod
def setup_clients(cls):
diff --git a/tempest/test.py b/tempest/test.py
index bac2085..ed8d12c 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -322,6 +322,13 @@
if 'alt' is cls.credentials and not credentials.is_alt_available():
msg = "Missing a 2nd set of API credentials in configuration."
raise cls.skipException(msg)
+ if hasattr(cls, 'identity_version'):
+ if cls.identity_version == 'v2':
+ if not CONF.identity_feature_enabled.api_v2:
+ raise cls.skipException("Identity api v2 is not enabled")
+ elif cls.identity_version == 'v3':
+ if not CONF.identity_feature_enabled.api_v3:
+ raise cls.skipException("Identity api v3 is not enabled")
@classmethod
def setup_credentials(cls):
@@ -424,14 +431,13 @@
return cls._creds_provider
@classmethod
- def get_client_manager(cls, identity_version=None,
- credential_type=None, roles=None, force_new=None):
+ def get_client_manager(cls, credential_type=None, roles=None,
+ force_new=None):
"""Returns an OpenStack client manager
Returns an OpenStack client manager based on either credential_type
or a list of roles. If neither is specified, it defaults to
credential_type 'primary'
- :param identity_version: string - v2 or v3
:param credential_type: string - primary, alt or admin
:param roles: list of roles
@@ -443,7 +449,6 @@
raise ValueError(msg)
if not any([roles, credential_type]):
credential_type = 'primary'
- cls.identity_version = identity_version
cred_provider = cls._get_credentials_provider()
if roles:
for role in roles: