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

Function testPutObjectWithChecksums

functional_tests.go:2183–2391  ·  view source on GitHub ↗

Test PutObject with custom checksums.

()

Source from the content-addressed store, hash-verified

2181
2182// Test PutObject with custom checksums.
2183func testPutObjectWithChecksums() {
2184 // initialize logging params
2185 startTime := time.Now()
2186 testName := getFuncName()
2187 function := "PutObject(bucketName, objectName, reader, size, opts)"
2188 args := map[string]interface{}{
2189 "bucketName": "",
2190 "objectName": "",
2191 "opts": "minio.PutObjectOptions{UserMetadata: metadata, Progress: progress}",
2192 }
2193
2194 if !isFullMode() {
2195 logIgnored(testName, function, args, startTime, "Skipping functional tests for short/quick runs")
2196 return
2197 }
2198
2199 c, err := NewClient(ClientConfig{TrailingHeaders: true})
2200 if err != nil {
2201 logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
2202 return
2203 }
2204
2205 // Generate a new random bucket name.
2206 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
2207 args["bucketName"] = bucketName
2208
2209 // Make a new bucket.
2210 err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"})
2211 if err != nil {
2212 logError(testName, function, args, startTime, "", "Make bucket failed", err)
2213 return
2214 }
2215
2216 defer cleanupBucket(bucketName, c)
2217 tests := []struct {
2218 cs minio.ChecksumType
2219 }{
2220 {cs: minio.ChecksumMD5},
2221 {cs: minio.ChecksumSHA512},
2222 {cs: minio.ChecksumXXHash64},
2223 {cs: minio.ChecksumXXHash3},
2224 {cs: minio.ChecksumXXHash128},
2225 {cs: minio.ChecksumCRC32C},
2226 {cs: minio.ChecksumCRC32},
2227 {cs: minio.ChecksumSHA1},
2228 {cs: minio.ChecksumSHA256},
2229 {cs: minio.ChecksumCRC64NVME},
2230 }
2231
2232 for _, test := range tests {
2233 if os.Getenv("MINT_NO_FULL_OBJECT") != "" && test.cs.FullObjectRequested() {
2234 continue
2235 }
2236 bufSize := dataFileMap["datafile-10-kB"]
2237
2238 // Save the data
2239 objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
2240 args["objectName"] = objectName

Callers 1

mainFunction · 0.85

Calls 15

MakeBucketMethod · 0.95
PutObjectMethod · 0.95
GetObjectMethod · 0.95
SetRangeMethod · 0.95
getFuncNameFunction · 0.85
isFullModeFunction · 0.85
logIgnoredFunction · 0.85
NewClientFunction · 0.85
logErrorFunction · 0.85
cleanupBucketFunction · 0.85
getDataReaderFunction · 0.85
ignore2026ChecksumErrorFunction · 0.85

Tested by

no test coverage detected