Merge "Use the configured version of identity in stress"
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index e84d627..62e60d6 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -23,7 +23,7 @@
from tempest_lib.common.utils import data_utils
from tempest import clients
-from tempest.common import cred_provider
+from tempest.common import isolated_creds
from tempest.common import ssh
from tempest import config
from tempest import exceptions
@@ -149,15 +149,22 @@
username = data_utils.rand_name("stress_user")
tenant_name = data_utils.rand_name("stress_tenant")
password = "pass"
- identity_client = admin_manager.identity_client
- tenant = identity_client.create_tenant(name=tenant_name)
- identity_client.create_user(username,
- password,
- tenant['id'],
- "email")
- creds = cred_provider.get_credentials(username=username,
- password=password,
- tenant_name=tenant_name)
+ if CONF.identity.auth_version == 'v2':
+ identity_client = admin_manager.identity_client
+ else:
+ identity_client = admin_manager.identity_v3_client
+ credentials_client = isolated_creds.get_creds_client(
+ identity_client)
+ project = credentials_client.create_project(
+ name=tenant_name, description=tenant_name)
+ user = credentials_client.create_user(username, password,
+ project['id'], "email")
+ # Add roles specified in config file
+ for conf_role in CONF.auth.tempest_roles:
+ credentials_client.assign_user_role(user, project,
+ conf_role)
+ creds = credentials_client.get_credentials(user, project,
+ password)
manager = clients.Manager(credentials=creds)
test_obj = importutils.import_class(test['action'])