Skip to content

Commit

Permalink
Stop resource leakage for negative tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mkoderer committed Nov 14, 2014
1 parent 1e6d39e commit 44dce62
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tempest/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,12 @@ def get_client_manager(cls, interface=None):
"""
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)
Expand Down

0 comments on commit 44dce62

Please sign in to comment.