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

Function TestStreamingReader

pkg/signer/request-signature-streaming_test.go:158–180  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

156}
157
158func TestStreamingReader(t *testing.T) {
159 reqTime, _ := time.Parse("20060102T150405Z", "20130524T000000Z")
160 location := "us-east-1"
161 secretAccessKeyID := "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
162 accessKeyID := "AKIAIOSFODNN7EXAMPLE"
163 dataLen := int64(65 * 1024)
164
165 req := NewRequest(http.MethodPut, "/examplebucket/chunkObject.txt", nil)
166 req.Header.Set("x-amz-storage-class", "REDUCED_REDUNDANCY")
167 req.ContentLength = 65 * 1024
168 req.Host = ""
169 req.URL.Host = "s3.amazonaws.com"
170
171 baseReader := io.NopCloser(bytes.NewReader(bytes.Repeat([]byte("a"), 65*1024)))
172 req.Body = baseReader
173 req = StreamingSignV4(req, accessKeyID, secretAccessKeyID, "", location, dataLen, reqTime, newSHA256Hasher())
174
175 b, err := io.ReadAll(req.Body)
176 if err != nil {
177 t.Errorf("Expected no error but received %v %d", err, len(b))
178 }
179 req.Body.Close()
180}

Callers

nothing calls this directly

Calls 5

NewRequestFunction · 0.85
StreamingSignV4Function · 0.85
newSHA256HasherFunction · 0.70
SetMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected