@@ -188,7 +188,13 @@ func TestS3IfNoneMatch(t *testing.T) {
188
188
ctx , _ , repo := setupTest (t )
189
189
defer tearDownTest (repo )
190
190
191
- client := newMinioClient (t , credentials .NewStaticV4 )
191
+ client := createS3Client (endpointURL + apiutil .BaseURL , t )
192
+ _ , err := client .CreateBucket (ctx , & s3.CreateBucketInput {
193
+ Bucket : aws .String ("test-bucket" ),
194
+ })
195
+
196
+ require .NoError (t , err , "Error creating bucket" )
197
+ //func (c *Client) CreateBucket(ctx context.Context, params *CreateBucketInput, optFns ...func(*Options)) (*CreateBucketOutput, error)
192
198
193
199
type TestCase struct {
194
200
Path string
@@ -213,15 +219,12 @@ func TestS3IfNoneMatch(t *testing.T) {
213
219
go func () {
214
220
defer wg .Done ()
215
221
for tc := range objects {
216
- opts := minio.PutObjectOptions {
217
- UserMetadata : map [string ]string {},
218
- }
219
-
220
- if tc .IfNoneMatch != "" {
221
- opts .UserMetadata ["If-None-Match" ] = tc .IfNoneMatch
222
- }
223
-
224
- _ , err := client .PutObject (ctx , repo , tc .Path , strings .NewReader (tc .Content ), int64 (len (tc .Content )), opts )
222
+ // Create the PutObject request
223
+ _ , err := client .PutObject (ctx , & s3.PutObjectInput {
224
+ Bucket : aws .String ("test-bucket" ),
225
+ Key : aws .String (tc .Path ),
226
+ Body : strings .NewReader (tc .Content ),
227
+ })
225
228
if (err != nil ) != tc .ExpectError {
226
229
t .Errorf ("unexpected error for Path %s with If-None-Match %q: %v" , tc .Path , tc .IfNoneMatch , err )
227
230
}
0 commit comments