Skip to content

Commit

Permalink
rptest: fix S3 bucket deletion
Browse files Browse the repository at this point in the history
A previous refactor of the code around emptying the bucket and deletion
was buggy. This resulted in tests not cleaning up their buckets
properly. This patch fixes the issue and adds an appropriately scary
error log.
  • Loading branch information
Vlad Lazar committed Jun 23, 2023
1 parent b63459d commit 0cb8c59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions tests/rptest/archival/s3_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ def bucket_is_listable():
f"Bucket {name} didn't become visible to ListObjectsvv2 requests")

def empty_and_delete_bucket(self, name, parallel=False):
failed_deletions = self.cloud_storage_client.empty_bucket(
self._si_settings.cloud_storage_bucket, parallel=parallel)
failed_deletions = self.empty_bucket(name, parallel=parallel)

assert len(failed_deletions) == 0
self.delete_bucket(name)
Expand Down
10 changes: 9 additions & 1 deletion tests/rptest/services/redpanda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2844,7 +2844,15 @@ def add_to_started_nodes(self, node):
def clean(self, **kwargs):
super().clean(**kwargs)
if self.cloud_storage_client:
self.delete_bucket_from_si()
try:
self.delete_bucket_from_si()
except Exception as e:
self.logger.error(
f"Failed to remove bucket {self._si_settings.cloud_storage_bucket}."
f" This may cause running out of quota in the cloud env. Please investigate: {e}"
)

raise e

def clean_node(self,
node,
Expand Down

0 comments on commit 0cb8c59

Please sign in to comment.