Change cred provider to enforce dynamic config
Current tests always dynamically create accounts when running. These tests do not run when, for example, LDAP is configured. This change allows murano_tempest_tests to correctly interpret use_dynamic_credentials config in the [auth] section of tempest.conf When use_dynamic_credentials is set to True, dynamic accounts will be created. When set to false, pre-provisioned accounts specified in accounts.yaml Tempest config will be used. Closes-Bug: #1677893 Change-Id: I51434685555c1da92401891a60285bf52571b8b5
This commit is contained in:
parent
c25e1619ca
commit
21190f00f4
|
@ -14,7 +14,6 @@
|
|||
# under the License.
|
||||
|
||||
from tempest.common import credentials_factory as common_creds
|
||||
from tempest.common import dynamic_creds
|
||||
from tempest import config
|
||||
from tempest.lib import base
|
||||
|
||||
|
@ -54,20 +53,19 @@ class BaseArtifactsTest(base.BaseTestCase):
|
|||
cls.admin_role = CONF.identity.admin_role
|
||||
else:
|
||||
cls.admin_role = 'admin'
|
||||
cls.dynamic_cred = dynamic_creds.DynamicCredentialProvider(
|
||||
identity_version=CONF.identity.auth_version,
|
||||
name=cls.__name__, admin_role=cls.admin_role,
|
||||
admin_creds=common_creds.get_configured_admin_credentials(
|
||||
'identity_admin'))
|
||||
cls.credentials = common_creds.get_credentials_provider(
|
||||
name=cls.__name__,
|
||||
force_tenant_isolation=CONF.auth.use_dynamic_credentials,
|
||||
identity_version=CONF.identity.auth_version)
|
||||
if type_of_creds == 'primary':
|
||||
creds = cls.dynamic_cred.get_primary_creds()
|
||||
creds = cls.credentials.get_primary_creds()
|
||||
elif type_of_creds == 'admin':
|
||||
creds = cls.dynamic_cred.get_admin_creds()
|
||||
creds = cls.credentials.get_admin_creds()
|
||||
elif type_of_creds == 'alt':
|
||||
creds = cls.dynamic_cred.get_alt_creds()
|
||||
creds = cls.credentials.get_alt_creds()
|
||||
else:
|
||||
creds = cls.dynamic_cred.get_credentials(type_of_creds)
|
||||
cls.dynamic_cred.type_of_creds = type_of_creds
|
||||
creds = cls.credentials.get_credentials(type_of_creds)
|
||||
cls.credentials.type_of_creds = type_of_creds
|
||||
|
||||
return creds.credentials
|
||||
|
||||
|
@ -95,7 +93,7 @@ class BaseArtifactsTest(base.BaseTestCase):
|
|||
@classmethod
|
||||
def clear_isolated_creds(cls):
|
||||
if hasattr(cls, "dynamic_cred"):
|
||||
cls.dynamic_cred.clear_creds()
|
||||
cls.credentials.clear_creds()
|
||||
|
||||
@classmethod
|
||||
def upload_package(cls, application_name, version=None, require=None):
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
# under the License.
|
||||
|
||||
from tempest.common import credentials_factory as common_creds
|
||||
from tempest.common import dynamic_creds
|
||||
from tempest import config
|
||||
from tempest.lib import base
|
||||
|
||||
|
@ -55,20 +54,19 @@ class BaseApplicationCatalogTest(base.BaseTestCase):
|
|||
else:
|
||||
cls.admin_role = 'admin'
|
||||
if not hasattr(cls, 'dynamic_cred'):
|
||||
cls.dynamic_cred = dynamic_creds.DynamicCredentialProvider(
|
||||
identity_version=CONF.identity.auth_version,
|
||||
name=cls.__name__, admin_role=cls.admin_role,
|
||||
admin_creds=common_creds.get_configured_admin_credentials(
|
||||
'identity_admin'))
|
||||
cls.credentials = common_creds.get_credentials_provider(
|
||||
name=cls.__name__,
|
||||
force_tenant_isolation=CONF.auth.use_dynamic_credentials,
|
||||
identity_version=CONF.identity.auth_version)
|
||||
if type_of_creds == 'primary':
|
||||
creds = cls.dynamic_cred.get_primary_creds()
|
||||
creds = cls.credentials.get_primary_creds()
|
||||
elif type_of_creds == 'admin':
|
||||
creds = cls.dynamic_cred.get_admin_creds()
|
||||
creds = cls.credentials.get_admin_creds()
|
||||
elif type_of_creds == 'alt':
|
||||
creds = cls.dynamic_cred.get_alt_creds()
|
||||
creds = cls.credentials.get_alt_creds()
|
||||
else:
|
||||
creds = cls.dynamic_cred.get_credentials(type_of_creds)
|
||||
cls.dynamic_cred.type_of_creds = type_of_creds
|
||||
creds = cls.credentials.get_credentials(type_of_creds)
|
||||
cls.credentials.type_of_creds = type_of_creds
|
||||
|
||||
return creds.credentials
|
||||
|
||||
|
@ -96,7 +94,7 @@ class BaseApplicationCatalogTest(base.BaseTestCase):
|
|||
@classmethod
|
||||
def clear_isolated_creds(cls):
|
||||
if hasattr(cls, "dynamic_cred"):
|
||||
cls.dynamic_cred.clear_creds()
|
||||
cls.credentials.clear_creds()
|
||||
|
||||
@staticmethod
|
||||
def _get_demo_app():
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
import json
|
||||
import time
|
||||
|
||||
from tempest.common import dynamic_creds
|
||||
from tempest.common import credentials_factory as common_creds
|
||||
from tempest import config
|
||||
from tempest.lib import base
|
||||
from tempest.lib import exceptions
|
||||
|
@ -42,17 +42,17 @@ class BaseServiceBrokerTest(base.BaseTestCase):
|
|||
@classmethod
|
||||
def get_client_with_isolated_creds(cls, name=None,
|
||||
type_of_creds="admin"):
|
||||
|
||||
cls.dynamic_cred = dynamic_creds.DynamicCredentialProvider(
|
||||
identity_version=CONF.identity.auth_version,
|
||||
name=cls.__name__)
|
||||
cls.credentials = common_creds.get_credentials_provider(
|
||||
name=cls.__name__,
|
||||
force_tenant_isolation=CONF.auth.use_dynamic_credentials,
|
||||
identity_version=CONF.identity.auth_version)
|
||||
if "admin" in type_of_creds:
|
||||
creds = cls.dynamic_cred.get_admin_creds()
|
||||
creds = cls.credentials.get_admin_creds()
|
||||
elif "alt" in type_of_creds:
|
||||
creds = cls.dynamic_cred.get_alt_creds()
|
||||
creds = cls.credentials.get_alt_creds()
|
||||
else:
|
||||
creds = cls.dynamic_cred.get_credentials(type_of_creds)
|
||||
cls.dynamic_cred.type_of_creds = type_of_creds
|
||||
creds = cls.credentials.get_credentials(type_of_creds)
|
||||
cls.credentials.type_of_creds = type_of_creds
|
||||
|
||||
os = clients.Manager(credentials=creds)
|
||||
client = os.service_broker_client
|
||||
|
@ -96,7 +96,7 @@ class BaseServiceBrokerTest(base.BaseTestCase):
|
|||
@classmethod
|
||||
def clear_isolated_creds(cls):
|
||||
if hasattr(cls, "dynamic_cred"):
|
||||
cls.dynamic_cred.clear_creds()
|
||||
cls.credentials.clear_creds()
|
||||
|
||||
def wait_for_result(self, instance_id, timeout):
|
||||
start_time = time.time()
|
||||
|
|
|
@ -19,7 +19,6 @@ import time
|
|||
|
||||
from tempest.clients import Manager as services_manager
|
||||
from tempest.common import credentials_factory as common_creds
|
||||
from tempest.common import dynamic_creds
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest.lib import base
|
||||
|
@ -62,20 +61,19 @@ class BaseApplicationCatalogScenarioTest(base.BaseTestCase):
|
|||
else:
|
||||
cls.admin_role = 'admin'
|
||||
if not hasattr(cls, 'dynamic_cred'):
|
||||
cls.dynamic_cred = dynamic_creds.DynamicCredentialProvider(
|
||||
identity_version=CONF.identity.auth_version,
|
||||
name=cls.__name__, admin_role=cls.admin_role,
|
||||
admin_creds=common_creds.get_configured_admin_credentials(
|
||||
'identity_admin'))
|
||||
cls.credentials = common_creds.get_credentials_provider(
|
||||
name=cls.__name__,
|
||||
force_tenant_isolation=CONF.auth.use_dynamic_credentials,
|
||||
identity_version=CONF.identity.auth_version)
|
||||
if type_of_creds == 'primary':
|
||||
creds = cls.dynamic_cred.get_primary_creds()
|
||||
creds = cls.credentials.get_primary_creds()
|
||||
elif type_of_creds == 'admin':
|
||||
creds = cls.dynamic_cred.get_admin_creds()
|
||||
creds = cls.credentials.get_admin_creds()
|
||||
elif type_of_creds == 'alt':
|
||||
creds = cls.dynamic_cred.get_alt_creds()
|
||||
creds = cls.credentials.get_alt_creds()
|
||||
else:
|
||||
creds = cls.dynamic_cred.get_credentials(type_of_creds)
|
||||
cls.dynamic_cred.type_of_creds = type_of_creds
|
||||
creds = cls.credentials.get_credentials(type_of_creds)
|
||||
cls.credentials.type_of_creds = type_of_creds
|
||||
|
||||
return creds.credentials
|
||||
|
||||
|
@ -118,7 +116,7 @@ class BaseApplicationCatalogScenarioTest(base.BaseTestCase):
|
|||
@classmethod
|
||||
def clear_isolated_creds(cls):
|
||||
if hasattr(cls, "dynamic_cred"):
|
||||
cls.dynamic_cred.clear_creds()
|
||||
cls.credentials.clear_creds()
|
||||
|
||||
def environment_delete(self, environment_id, timeout=180):
|
||||
self.application_catalog_client.delete_environment(environment_id)
|
||||
|
|
Loading…
Reference in New Issue