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

Function testGetObjectACLContext

functional_tests.go:13282–13441  ·  view source on GitHub ↗

Test get object ACLs with GetObjectACL with custom provided context

()

Source from the content-addressed store, hash-verified

13280
13281// Test get object ACLs with GetObjectACL with custom provided context
13282func testGetObjectACLContext() {
13283 // initialize logging params
13284 startTime := time.Now()
13285 testName := getFuncName()
13286 function := "GetObjectACL(ctx, bucketName, objectName)"
13287 args := map[string]interface{}{
13288 "ctx": "",
13289 "bucketName": "",
13290 "objectName": "",
13291 }
13292
13293 c, err := NewClient(ClientConfig{})
13294 if err != nil {
13295 logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err)
13296 return
13297 }
13298
13299 // Generate a new random bucket name.
13300 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
13301 args["bucketName"] = bucketName
13302
13303 // Make a new bucket.
13304 err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"})
13305 if err != nil {
13306 logError(testName, function, args, startTime, "", "MakeBucket failed", err)
13307 return
13308 }
13309
13310 defer cleanupBucket(bucketName, c)
13311
13312 bufSize := dataFileMap["datafile-1-MB"]
13313 reader := getDataReader("datafile-1-MB")
13314 defer reader.Close()
13315 // Save the data
13316 objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
13317 args["objectName"] = objectName
13318
13319 // Add meta data to add a canned acl
13320 metaData := map[string]string{
13321 "X-Amz-Acl": "public-read-write",
13322 }
13323
13324 _, err = c.PutObject(context.Background(), bucketName,
13325 objectName, reader, int64(bufSize),
13326 minio.PutObjectOptions{
13327 ContentType: "binary/octet-stream",
13328 UserMetadata: metaData,
13329 })
13330 if err != nil {
13331 logError(testName, function, args, startTime, "", "PutObject failed", err)
13332 return
13333 }
13334
13335 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
13336 args["ctx"] = ctx
13337 defer cancel()
13338
13339 // 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