Skip to content

Commit

Permalink
Clearing pipeline integ test buckets with versioned objects. (aws#3094)
Browse files Browse the repository at this point in the history
* Clearing pipeline integ test buckets with versioned objects.

* Fixing black formatting.

Co-authored-by: Tarun Mall <[email protected]>
  • Loading branch information
2 people authored and moelasmar committed Aug 4, 2021
1 parent 43cd1a4 commit a67a369
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/integration/pipeline/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ def _cleanup_s3_buckets(self, stack_name):
for resource in stack_resources["StackResources"]
if resource["ResourceType"] == "AWS::S3::Bucket"
]
s3_client = boto3.client("s3")
session = boto3.session.Session()
s3_client = session.resource("s3")
for bucket in buckets:
s3_client.delete_bucket(Bucket=bucket.get("PhysicalResourceId"))
bucket = s3_client.Bucket(bucket)
bucket.object_versions.delete()
except botocore.exceptions.ClientError:
"""No need to fail in cleanup"""

Expand Down

0 comments on commit a67a369

Please sign in to comment.