-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor improvements to GCS driver and Query Path (#693)
* Checkpoint: replace gcs ioutils Signed-off-by: Annanay <[email protected]> * Replace ioutil with buf.ReadFrom with exact response size for gcs & s3 Signed-off-by: Annanay <[email protected]> * Fix ContentLength header in spanIdDeduper middleware Signed-off-by: Annanay <[email protected]> * Update GCS sdk version v1.12.0 => v1.15.0 Signed-off-by: Annanay <[email protected]> * Check resp is non-nil to avoid server panic Signed-off-by: Annanay <[email protected]> * Use ReadAllWithEstimate, add some tests around it Signed-off-by: Annanay <[email protected]> * make make make fmt fmt fmt Signed-off-by: Annanay <[email protected]>
- Loading branch information
Showing
113 changed files
with
3,952 additions
and
1,996 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io | ||
|
||
import ( | ||
"bytes" | ||
"math/rand" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
var testBufLength = 10 | ||
|
||
func TestReadAllWithEstimate(t *testing.T) { | ||
buf := make([]byte, testBufLength) | ||
_, err := rand.Read(buf) | ||
assert.NoError(t, err) | ||
assert.Equal(t, testBufLength, len(buf)) | ||
assert.Equal(t, testBufLength, cap(buf)) | ||
|
||
actualBuf, err := ReadAllWithEstimate(bytes.NewReader(buf), int64(testBufLength)) | ||
assert.NoError(t, err) | ||
assert.Equal(t, buf, actualBuf) | ||
assert.Equal(t, testBufLength, len(actualBuf)) | ||
assert.Equal(t, testBufLength+1, cap(actualBuf)) // one extra byte used in ReadAllWithEstimate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.