MCPcopy
hub / github.com/minio/minio-go / testGetObjectACLContext

Function testGetObjectACLContext

functional_tests.go:13178–13337  ·  view source on GitHub ↗

Test get object ACLs with GetObjectACL with custom provided context

()

Source from the content-addressed store, hash-verified

13176
13177// Test get object ACLs with GetObjectACL with custom provided context
13178func testGetObjectACLContext() {
13179 // initialize logging params
13180 startTime := time.Now()
13181 testName := getFuncName()
13182 function := "GetObjectACL(ctx, bucketName, objectName)"
13183 args := map[string]interface{}{
13184 "ctx": "",
13185 "bucketName": "",
13186 "objectName": "",
13187 }
13188
13189 c, err := NewClient(ClientConfig{})
13190 if err != nil {
13191 logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err)
13192 return
13193 }
13194
13195 // Generate a new random bucket name.
13196 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
13197 args["bucketName"] = bucketName
13198
13199 // Make a new bucket.
13200 err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"})
13201 if err != nil {
13202 logError(testName, function, args, startTime, "", "MakeBucket failed", err)
13203 return
13204 }
13205
13206 defer cleanupBucket(bucketName, c)
13207
13208 bufSize := dataFileMap["datafile-1-MB"]
13209 reader := getDataReader("datafile-1-MB")
13210 defer reader.Close()
13211 // Save the data
13212 objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
13213 args["objectName"] = objectName
13214
13215 // Add meta data to add a canned acl
13216 metaData := map[string]string{
13217 "X-Amz-Acl": "public-read-write",
13218 }
13219
13220 _, err = c.PutObject(context.Background(), bucketName,
13221 objectName, reader, int64(bufSize),
13222 minio.PutObjectOptions{
13223 ContentType: "binary/octet-stream",
13224 UserMetadata: metaData,
13225 })
13226 if err != nil {
13227 logError(testName, function, args, startTime, "", "PutObject failed", err)
13228 return
13229 }
13230
13231 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
13232 args["ctx"] = ctx
13233 defer cancel()
13234
13235 // Read the data back

Callers 1

mainFunction · 0.85

Calls 11

MakeBucketMethod · 0.95
PutObjectMethod · 0.95
GetObjectACLMethod · 0.95
getFuncNameFunction · 0.85
NewClientFunction · 0.85
logErrorFunction · 0.85
cleanupBucketFunction · 0.85
getDataReaderFunction · 0.85
logSuccessFunction · 0.85
randStringFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…