(t *testing.T)
| 156 | } |
| 157 | |
| 158 | func 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 | } |
nothing calls this directly
no test coverage detected