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

Function testGetObjectAttributesSSECEncryption

functional_tests.go:3504–3581  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3502}
3503
3504func testGetObjectAttributesSSECEncryption() {
3505 startTime := time.Now()
3506 testName := getFuncName()
3507 function := "GetObjectAttributes(ctx, bucketName, objectName, opts)"
3508 args := map[string]interface{}{
3509 "bucketName": "",
3510 "objectName": "",
3511 "opts": "minio.ObjectAttributesOptions{}",
3512 }
3513
3514 if !isFullMode() {
3515 logIgnored(testName, function, args, startTime, "Skipping functional tests for short/quick runs")
3516 return
3517 }
3518
3519 c, err := NewClient(ClientConfig{TrailingHeaders: true})
3520 if err != nil {
3521 logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
3522 return
3523 }
3524
3525 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
3526 args["bucketName"] = bucketName
3527 err = c.MakeBucket(
3528 context.Background(),
3529 bucketName,
3530 minio.MakeBucketOptions{Region: "us-east-1"},
3531 )
3532 if err != nil {
3533 logError(testName, function, args, startTime, "", "Make bucket failed", err)
3534 return
3535 }
3536
3537 defer cleanupBucket(bucketName, c)
3538
3539 objectName := "encrypted-object"
3540 args["objectName"] = objectName
3541 bufSize := dataFileMap["datafile-11-MB"]
3542 reader := getDataReader("datafile-11-MB")
3543
3544 sse := encrypt.DefaultPBKDF([]byte("word1 word2 word3 word4"), []byte(bucketName+objectName))
3545
3546 info, err := c.PutObject(context.Background(), bucketName, objectName, reader, int64(bufSize), minio.PutObjectOptions{
3547 ContentType: "content/custom",
3548 SendContentMd5: false,
3549 ServerSideEncryption: sse,
3550 PartSize: uint64(bufSize) / 2,
3551 Checksum: minio.ChecksumCRC32C,
3552 })
3553 if err != nil {
3554 logError(testName, function, args, startTime, "", "PutObject failed", err)
3555 return
3556 }
3557
3558 opts := minio.ObjectAttributesOptions{
3559 ServerSideEncryption: sse,
3560 }
3561 attr, err := c.GetObjectAttributes(context.Background(), bucketName, objectName, opts)

Callers 1

mainFunction · 0.85

Calls 13

MakeBucketMethod · 0.95
PutObjectMethod · 0.95
GetObjectAttributesMethod · 0.95
getFuncNameFunction · 0.85
isFullModeFunction · 0.85
logIgnoredFunction · 0.85
NewClientFunction · 0.85
logErrorFunction · 0.85
cleanupBucketFunction · 0.85
getDataReaderFunction · 0.85
logSuccessFunction · 0.85

Tested by

no test coverage detected