Ensure reverting test env if the env is temporarily changed
test_tempurl_keys_hidden_from_acl_readonly changes test env parameter temporarily for container HEAD. After that the test reverts the change. But if the HEAD failed with exception, the change is not reverted. With the non reverted change, some other tests fails even if the test have no problems. This patch ensures the reversion by using try-finally. Change-Id: I8cd7928da6211e5516992fe9f2bc8e568bcab443
This commit is contained in:
parent
6060af8db9
commit
532ac9e1c7
@ -588,9 +588,12 @@ class TestContainerTempurl(Base):
|
||||
if not tf.cluster_info.get('tempauth'):
|
||||
raise SkipTest('TEMP AUTH SPECIFIC TEST')
|
||||
original_token = self.env.container.conn.storage_token
|
||||
self.env.container.conn.storage_token = self.env.conn2.storage_token
|
||||
metadata = self.env.container.info()
|
||||
self.env.container.conn.storage_token = original_token
|
||||
try:
|
||||
self.env.container.conn.storage_token = \
|
||||
self.env.conn2.storage_token
|
||||
metadata = self.env.container.info()
|
||||
finally:
|
||||
self.env.container.conn.storage_token = original_token
|
||||
|
||||
self.assertNotIn(
|
||||
'tempurl_key', metadata,
|
||||
|
Loading…
x
Reference in New Issue
Block a user