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

Function testPutObjectWithTrailingChecksums

functional_tests.go:2394–2605  ·  view source on GitHub ↗

Test PutObject with custom checksums.

()

Source from the content-addressed store, hash-verified

2392
2393// Test PutObject with custom checksums.
2394func testPutObjectWithTrailingChecksums() {
2395 // initialize logging params
2396 startTime := time.Now()
2397 testName := getFuncName()
2398 function := "PutObject(bucketName, objectName, reader,size, opts)"
2399 args := map[string]interface{}{
2400 "bucketName": "",
2401 "objectName": "",
2402 "opts": "minio.PutObjectOptions{UserMetadata: metadata, Progress: progress, TrailChecksum: xxx}",
2403 }
2404
2405 if !isFullMode() {
2406 logIgnored(testName, function, args, startTime, "Skipping functional tests for short/quick runs")
2407 return
2408 }
2409
2410 c, err := NewClient(ClientConfig{TrailingHeaders: true})
2411 if err != nil {
2412 logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
2413 return
2414 }
2415
2416 // Generate a new random bucket name.
2417 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
2418 args["bucketName"] = bucketName
2419
2420 // Make a new bucket.
2421 err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"})
2422 if err != nil {
2423 logError(testName, function, args, startTime, "", "Make bucket failed", err)
2424 return
2425 }
2426
2427 defer cleanupBucket(bucketName, c)
2428 tests := []struct {
2429 cs minio.ChecksumType
2430 }{
2431 {cs: minio.ChecksumMD5},
2432 {cs: minio.ChecksumSHA512},
2433 {cs: minio.ChecksumXXHash64},
2434 {cs: minio.ChecksumXXHash3},
2435 {cs: minio.ChecksumXXHash128},
2436 {cs: minio.ChecksumCRC64NVME},
2437 {cs: minio.ChecksumCRC32C},
2438 {cs: minio.ChecksumCRC32},
2439 {cs: minio.ChecksumSHA1},
2440 {cs: minio.ChecksumSHA256},
2441 }
2442 for _, test := range tests {
2443 if os.Getenv("MINT_NO_FULL_OBJECT") != "" && test.cs.FullObjectRequested() {
2444 continue
2445 }
2446 function := "PutObject(bucketName, objectName, reader,size, opts)"
2447 bufSize := dataFileMap["datafile-10-kB"]
2448
2449 // Save the data
2450 objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
2451 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