Clean up all secrets in functional tests

The deletion of the secrets wasn't happening correctly in the
clean-up methods for the CLI functional tests because items
were being deleted from the lists as the list was being iterated
over.

Includes general clean-up of the entities being created and deleted.

Change-Id: I87d0ef93505ee46ab8314a2562b5d4ab59717649
This commit is contained in:
Kaitlin Farr 2017-02-24 16:58:58 -05:00
parent 2cf63f9ca4
commit 22b3002fbc
4 changed files with 9 additions and 3 deletions

View File

@ -90,5 +90,8 @@ class ContainerBehaviors(base_behaviors.BaseBehaviors):
def delete_all_created_containers(self):
"""Delete all containers that we created"""
for href in self.container_hrefs_to_delete:
# Create a copy of the list -- otherwise delete_container will remove
# items from the list as we are iterating over it
containers_to_delete = list(self.container_hrefs_to_delete)
for href in containers_to_delete:
self.delete_container(href)

View File

@ -141,5 +141,8 @@ class SecretBehaviors(base_behaviors.BaseBehaviors):
def delete_all_created_secrets(self):
"""Delete all secrets that we created"""
for href in self.secret_hrefs_to_delete:
# Create a copy of the list -- otherwise delete_secret will remove
# items from the list as we are iterating over it
secrets_to_delete = list(self.secret_hrefs_to_delete)
for href in secrets_to_delete:
self.delete_secret(href)

View File

@ -136,7 +136,6 @@ class ACLTestCase(CmdLineTestCase):
secret_ref = self.secret_behaviors.store_secret()
container_ref = self.container_behaviors.create_container(
secret_hrefs=[secret_ref])
secret_ref = self.secret_behaviors.store_secret()
data = self.acl_behaviors.acl_submit(entity_ref=container_ref,
project_access=False,

View File

@ -28,6 +28,7 @@ class ContainerTestCase(CmdLineTestCase):
def tearDown(self):
super(ContainerTestCase, self).tearDown()
self.secret_behaviors.delete_all_created_secrets()
self.container_behaviors.delete_all_created_containers()
@testcase.attr('positive')