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

Function testPutObjectWithChecksums

functional_tests.go:2079–2287  ·  view source on GitHub ↗

Test PutObject with custom checksums.

()

Source from the content-addressed store, hash-verified

2077
2078// Test PutObject with custom checksums.
2079func testPutObjectWithChecksums() {
2080 // initialize logging params
2081 startTime := time.Now()
2082 testName := getFuncName()
2083 function := "PutObject(bucketName, objectName, reader, size, opts)"
2084 args := map[string]interface{}{
2085 "bucketName": "",
2086 "objectName": "",
2087 "opts": "minio.PutObjectOptions{UserMetadata: metadata, Progress: progress}",
2088 }
2089
2090 if !isFullMode() {
2091 logIgnored(testName, function, args, startTime, "Skipping functional tests for short/quick runs")
2092 return
2093 }
2094
2095 c, err := NewClient(ClientConfig{TrailingHeaders: true})
2096 if err != nil {
2097 logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
2098 return
2099 }
2100
2101 // Generate a new random bucket name.
2102 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
2103 args["bucketName"] = bucketName
2104
2105 // Make a new bucket.
2106 err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"})
2107 if err != nil {
2108 logError(testName, function, args, startTime, "", "Make bucket failed", err)
2109 return
2110 }
2111
2112 defer cleanupBucket(bucketName, c)
2113 tests := []struct {
2114 cs minio.ChecksumType
2115 }{
2116 {cs: minio.ChecksumMD5},
2117 {cs: minio.ChecksumSHA512},
2118 {cs: minio.ChecksumXXHash64},
2119 {cs: minio.ChecksumXXHash3},
2120 {cs: minio.ChecksumXXHash128},
2121 {cs: minio.ChecksumCRC32C},
2122 {cs: minio.ChecksumCRC32},
2123 {cs: minio.ChecksumSHA1},
2124 {cs: minio.ChecksumSHA256},
2125 {cs: minio.ChecksumCRC64NVME},
2126 }
2127
2128 for _, test := range tests {
2129 if os.Getenv("MINT_NO_FULL_OBJECT") != "" && test.cs.FullObjectRequested() {
2130 continue
2131 }
2132 bufSize := dataFileMap["datafile-10-kB"]
2133
2134 // Save the data
2135 objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
2136 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