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

Function testPutObjectWithTrailingChecksums

functional_tests.go:2290–2501  ·  view source on GitHub ↗

Test PutObject with custom checksums.

()

Source from the content-addressed store, hash-verified

2288
2289// Test PutObject with custom checksums.
2290func testPutObjectWithTrailingChecksums() {
2291 // initialize logging params
2292 startTime := time.Now()
2293 testName := getFuncName()
2294 function := "PutObject(bucketName, objectName, reader,size, opts)"
2295 args := map[string]interface{}{
2296 "bucketName": "",
2297 "objectName": "",
2298 "opts": "minio.PutObjectOptions{UserMetadata: metadata, Progress: progress, TrailChecksum: xxx}",
2299 }
2300
2301 if !isFullMode() {
2302 logIgnored(testName, function, args, startTime, "Skipping functional tests for short/quick runs")
2303 return
2304 }
2305
2306 c, err := NewClient(ClientConfig{TrailingHeaders: true})
2307 if err != nil {
2308 logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
2309 return
2310 }
2311
2312 // Generate a new random bucket name.
2313 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
2314 args["bucketName"] = bucketName
2315
2316 // Make a new bucket.
2317 err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"})
2318 if err != nil {
2319 logError(testName, function, args, startTime, "", "Make bucket failed", err)
2320 return
2321 }
2322
2323 defer cleanupBucket(bucketName, c)
2324 tests := []struct {
2325 cs minio.ChecksumType
2326 }{
2327 {cs: minio.ChecksumMD5},
2328 {cs: minio.ChecksumSHA512},
2329 {cs: minio.ChecksumXXHash64},
2330 {cs: minio.ChecksumXXHash3},
2331 {cs: minio.ChecksumXXHash128},
2332 {cs: minio.ChecksumCRC64NVME},
2333 {cs: minio.ChecksumCRC32C},
2334 {cs: minio.ChecksumCRC32},
2335 {cs: minio.ChecksumSHA1},
2336 {cs: minio.ChecksumSHA256},
2337 }
2338 for _, test := range tests {
2339 if os.Getenv("MINT_NO_FULL_OBJECT") != "" && test.cs.FullObjectRequested() {
2340 continue
2341 }
2342 function := "PutObject(bucketName, objectName, reader,size, opts)"
2343 bufSize := dataFileMap["datafile-10-kB"]
2344
2345 // Save the data
2346 objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
2347 args["objectName"] = objectName

Callers 1

mainFunction · 0.85

Calls 15

MakeBucketMethod · 0.95
PutObjectMethod · 0.95
GetObjectMethod · 0.95
SetRangeMethod · 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

Tested by

no test coverage detected