From 150776ed68388af4b7d372665dc9b4f4f64400c1 Mon Sep 17 00:00:00 2001 From: Itamar Yuran Date: Wed, 25 Dec 2024 15:03:07 +0100 Subject: [PATCH] beginning s3 client --- esti/s3_gateway_test.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/esti/s3_gateway_test.go b/esti/s3_gateway_test.go index 773c6d83a9d..ef335863ec9 100644 --- a/esti/s3_gateway_test.go +++ b/esti/s3_gateway_test.go @@ -188,7 +188,13 @@ func TestS3IfNoneMatch(t *testing.T) { ctx, _, repo := setupTest(t) defer tearDownTest(repo) - client := newMinioClient(t, credentials.NewStaticV4) + client := createS3Client(endpointURL+apiutil.BaseURL, t) + _, err := client.CreateBucket(ctx, &s3.CreateBucketInput{ + Bucket: aws.String("test-bucket"), + }) + + require.NoError(t, err, "Error creating bucket") + //func (c *Client) CreateBucket(ctx context.Context, params *CreateBucketInput, optFns ...func(*Options)) (*CreateBucketOutput, error) type TestCase struct { Path string @@ -213,15 +219,12 @@ func TestS3IfNoneMatch(t *testing.T) { go func() { defer wg.Done() for tc := range objects { - opts := minio.PutObjectOptions{ - UserMetadata: map[string]string{}, - } - - if tc.IfNoneMatch != "" { - opts.UserMetadata["If-None-Match"] = tc.IfNoneMatch - } - - _, err := client.PutObject(ctx, repo, tc.Path, strings.NewReader(tc.Content), int64(len(tc.Content)), opts) + // Create the PutObject request + _, err := client.PutObject(ctx, &s3.PutObjectInput{ + Bucket: aws.String("test-bucket"), + Key: aws.String(tc.Path), + Body: strings.NewReader(tc.Content), + }) if (err != nil) != tc.ExpectError { t.Errorf("unexpected error for Path %s with If-None-Match %q: %v", tc.Path, tc.IfNoneMatch, err) }