Always provision accounts with auth_version

The config value identity.auth_version defines the identity API
version used for all common API tests, such as identity API calls
performed by non-identity tests, as well as provisioning of
dynamic accounts, with the exception of identity tests.

Since the v2 API is deprecated, we don't need to run v2 admin
tests in the gate anymore. However v2 user APIs are most likely
still widely used by OpenStack users, and we should keep those
test runnings.

Right now identity tests control which version of the identity
API is used to allocate / provision test accounts by setting
an identity_version class attribute.

This behaviour forces us to run an identity v2 admin endpoint
only to be able to provision accounts for identity v2 tests.

This commit changes the current behaviour to always provision
accounts with the identity API version specified in
CONF.identity.auth_version. When v3 is configured (which is
the case in all gate jobs), v3 credentials will be provisioned
and then used for v2 non-admin tests.

Depends-on: I801e6740258ddea2a1b628a209970e0307d39d12
Change-Id: I2601433585740030ab61433f0e8ca1a919275d9f
This commit is contained in:
Andrea Frittoli 2017-04-20 15:28:30 +01:00
parent 8bf816a7fb
commit 9e01dbbe40
1 changed files with 4 additions and 3 deletions

View File

@ -455,7 +455,9 @@ class BaseTestCase(testtools.testcase.WithAttributes,
"""Returns a credentials provider
If no credential provider exists yet creates one.
It uses self.identity_version if defined, or the configuration value
It always use the configuration value from identity.auth_version,
since we always want to provision accounts with the current version
of the identity API.
"""
if (not hasattr(cls, '_creds_provider') or not cls._creds_provider or
not cls._creds_provider.name == cls.__name__):
@ -464,8 +466,7 @@ class BaseTestCase(testtools.testcase.WithAttributes,
cls._creds_provider = credentials.get_credentials_provider(
name=cls.__name__, network_resources=cls.network_resources,
force_tenant_isolation=force_tenant_isolation,
identity_version=cls.get_identity_version())
force_tenant_isolation=force_tenant_isolation)
return cls._creds_provider
@classmethod