Skip to content

Commit

Permalink
beginning s3 client
Browse files Browse the repository at this point in the history
  • Loading branch information
ItamarYuran committed Dec 25, 2024
1 parent 150776e commit d7e22f4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions esti/s3_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/go-openapi/swag"

"github.com/minio/minio-go/v7"
Expand Down Expand Up @@ -188,13 +189,16 @@ func TestS3IfNoneMatch(t *testing.T) {
ctx, _, repo := setupTest(t)
defer tearDownTest(repo)

client := createS3Client(endpointURL+apiutil.BaseURL, t)
client := createS3Client(endpointURL, t)
bucketName := "test-bucket"
_, err := client.CreateBucket(ctx, &s3.CreateBucketInput{
Bucket: aws.String("test-bucket"),
Bucket: aws.String(bucketName),
CreateBucketConfiguration: &types.CreateBucketConfiguration{
LocationConstraint: types.BucketLocationConstraint("us-east-1"),
},
})

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
Expand All @@ -221,13 +225,13 @@ func TestS3IfNoneMatch(t *testing.T) {
for tc := range objects {
// Create the PutObject request
_, err := client.PutObject(ctx, &s3.PutObjectInput{
Bucket: aws.String("test-bucket"),
Bucket: aws.String(bucketName),
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)
}

require.NoError(t, err, "Error uploading bucket")

}
}()
}
Expand Down

0 comments on commit d7e22f4

Please sign in to comment.