Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Refactoring out helpers #3465

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions test/helpers/aws.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//go:build aws

// Package helpers provides helper functions for tests.
package helpers

import (
"testing"
"time"
)

// DeleteS3BucketWithRetry will attempt to delete the specified S3 bucket, retrying up to 3 times if there are errors to
// handle eventual consistency issues.
func DeleteS3BucketWithRetry(t *testing.T, awsRegion string, bucketName string) {
t.Helper()

for i := 0; i < 3; i++ {
err := DeleteS3BucketE(t, awsRegion, bucketName)
if err == nil {
return
}

t.Logf("Error deleting s3 bucket %s. Sleeping for 10 seconds before retrying.", bucketName)
time.Sleep(10 * time.Second) //nolint:mnd
}

t.Fatalf("Max retries attempting to delete s3 bucket %s in region %s", bucketName, awsRegion)
}
Loading