Stop resource leakage for negative tests
get_client_manager should only create a new isolated_creds class if
there isn't already a isolated_creads instance bound to the test.
Change-Id: I44fd05d3c1dc713ec7bd176af689b008fbb5d7eb
Fixes-bug: #1371706
diff --git a/tempest/test.py b/tempest/test.py
index 1c6265d..db8736e 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -342,10 +342,12 @@
"""
force_tenant_isolation = getattr(cls, 'force_tenant_isolation', None)
- cls.isolated_creds = credentials.get_isolated_credentials(
- name=cls.__name__, network_resources=cls.network_resources,
- force_tenant_isolation=force_tenant_isolation,
- )
+ if (not hasattr(cls, 'isolated_creds') or
+ not cls.isolated_creds.name == cls.__name__):
+ cls.isolated_creds = credentials.get_isolated_credentials(
+ name=cls.__name__, network_resources=cls.network_resources,
+ force_tenant_isolation=force_tenant_isolation,
+ )
creds = cls.isolated_creds.get_primary_creds()
params = dict(credentials=creds, service=cls._service)