s3/test: fix minio bucket creation in tests
@@ -257,7 +257,7 @@ func TestS3StorageMinio(t *testing.T) {
DoNotUseTLS: true,
}
- getOrCreateBucket(t, options)
+ createBucket(t, options)
testStorage(t, options, true, blob.PutOptions{})
}
@@ -292,7 +292,7 @@ func TestS3StorageMinioSelfSignedCert(t *testing.T) {
DoNotVerifyTLS: true,
}
- getOrCreateBucket(t, options)
+ createBucket(t, options)
testStorage(t, options, true, blob.PutOptions{})
}
@@ -333,7 +333,7 @@ func TestS3StorageMinioSTS(t *testing.T) {
kopiaAccessKeyID, kopiaSecretKey, kopiaSessionToken := createMinioSessionToken(t, minioEndpoint, minioRootAccessKeyID, minioRootSecretAccessKey, minioBucketName)
- getOrCreateBucket(t, &Options{
+ createBucket(t, &Options{
Endpoint: minioEndpoint,
AccessKeyID: minioRootAccessKeyID,
SecretAccessKey: minioRootSecretAccessKey,
@@ -518,6 +518,14 @@ func getOrCreateBucket(tb testing.TB, opt *Options) {
getOrMakeBucket(tb, minioClient, opt, false)
}
+func createBucket(tb testing.TB, opt *Options) {
+ tb.Helper()
+
+ minioClient := createClient(tb, opt)
+
+ makeBucket(tb, minioClient, opt, false)
+}
+
func getOrMakeBucket(tb testing.TB, cli *minio.Client, opt *Options, objectLocking bool) {
tb.Helper()
@@ -532,6 +540,14 @@ func getOrMakeBucket(tb testing.TB, cli *minio.Client, opt *Options, objectLocki
return
}
+ makeBucket(tb, cli, opt, objectLocking)
+}
+
+func makeBucket(tb testing.TB, cli *minio.Client, opt *Options, objectLocking bool) {
+ tb.Helper()
+
+ ctx := testlogging.Context(tb)
+
if err := cli.MakeBucket(ctx, opt.BucketName, minio.MakeBucketOptions{
Region: opt.Region,
ObjectLocking: objectLocking,
