Merge "Decrease overall run time when identity auth is set to v3."
diff --git a/contrib/post_test_hook.sh b/contrib/post_test_hook.sh
index 3961474..b864a9b 100644
--- a/contrib/post_test_hook.sh
+++ b/contrib/post_test_hook.sh
@@ -50,6 +50,7 @@
# Set additional, necessary CONF values
iniset $TEMPEST_CONFIG auth use_dynamic_credentials True
iniset $TEMPEST_CONFIG auth tempest_roles Member
+iniset $TEMPEST_CONFIG identity auth_version v3
# Give permissions back to Tempest.
sudo chown -R tempest:stack $BASE/new/tempest
diff --git a/patrole_tempest_plugin/rbac_utils.py b/patrole_tempest_plugin/rbac_utils.py
index ae018de..abbb435 100644
--- a/patrole_tempest_plugin/rbac_utils.py
+++ b/patrole_tempest_plugin/rbac_utils.py
@@ -87,11 +87,12 @@
raise
finally:
- test_obj.auth_provider.clear_auth()
- # Sleep to avoid 401 errors caused by rounding in timing of fernet
- # token creation.
- time.sleep(1)
- test_obj.auth_provider.set_auth()
+ if BaseTestCase.get_identity_version() != 'v3':
+ test_obj.auth_provider.clear_auth()
+ # Sleep to avoid 401 errors caused by rounding in timing of
+ # fernet token creation.
+ time.sleep(1)
+ test_obj.auth_provider.set_auth()
def _clear_user_roles(cls, user_id, tenant_id):
roles = cls.creds_client.roles_client.list_user_roles_on_project(