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

Function testSSECEncryptionFPut

functional_tests.go:7117–7225  ·  view source on GitHub ↗

TestEncryptionFPut tests encryption with customer specified encryption keys

()

Source from the content-addressed store, hash-verified

7115
7116// TestEncryptionFPut tests encryption with customer specified encryption keys
7117func testSSECEncryptionFPut() {
7118 // initialize logging params
7119 startTime := time.Now()
7120 testName := getFuncName()
7121 function := "FPutEncryptedObject(bucketName, objectName, filePath, contentType, sse)"
7122 args := map[string]interface{}{
7123 "bucketName": "",
7124 "objectName": "",
7125 "filePath": "",
7126 "contentType": "",
7127 "sse": "",
7128 }
7129
7130 c, err := NewClient(ClientConfig{})
7131 if err != nil {
7132 logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
7133 return
7134 }
7135
7136 // Generate a new random bucket name.
7137 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
7138 args["bucketName"] = bucketName
7139
7140 // Make a new bucket.
7141 err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"})
7142 if err != nil {
7143 logError(testName, function, args, startTime, "", "MakeBucket failed", err)
7144 return
7145 }
7146
7147 defer cleanupBucket(bucketName, c)
7148
7149 // Object custom metadata
7150 customContentType := "custom/contenttype"
7151 args["metadata"] = customContentType
7152
7153 testCases := []struct {
7154 buf []byte
7155 }{
7156 {buf: bytes.Repeat([]byte("F"), 0)},
7157 {buf: bytes.Repeat([]byte("F"), 1)},
7158 {buf: bytes.Repeat([]byte("F"), 15)},
7159 {buf: bytes.Repeat([]byte("F"), 16)},
7160 {buf: bytes.Repeat([]byte("F"), 17)},
7161 {buf: bytes.Repeat([]byte("F"), 31)},
7162 {buf: bytes.Repeat([]byte("F"), 32)},
7163 {buf: bytes.Repeat([]byte("F"), 33)},
7164 {buf: bytes.Repeat([]byte("F"), 1024)},
7165 {buf: bytes.Repeat([]byte("F"), 1024*2)},
7166 {buf: bytes.Repeat([]byte("F"), 1024*1024)},
7167 }
7168
7169 const password = "correct horse battery staple" // https://xkcd.com/936/
7170 for i, testCase := range testCases {
7171 // Generate a random object name
7172 objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
7173 args["objectName"] = objectName
7174

Callers 1

mainFunction · 0.85

Calls 14

MakeBucketMethod · 0.95
FPutObjectMethod · 0.95
GetObjectMethod · 0.95
getFuncNameFunction · 0.85
NewClientFunction · 0.85
logErrorFunction · 0.85
cleanupBucketFunction · 0.85
logSuccessFunction · 0.85
LenMethod · 0.80
EqualMethod · 0.80
randStringFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected