1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
From: Daniel Swarbrick <dswarbrick@debian.org>
Date: Tue, 21 Feb 2023 13:41:02 +0800
Subject: Fix 32-bit integer overflows in tests
Last-Update: 2023-01-30
Bug: https://github.com/aws/aws-sdk-go-v2/issues/1998
---
aws/retry/jitter_backoff_test.go | 2 +-
service/internal/benchmark/dynamodb/customizations_test.go | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/aws/retry/jitter_backoff_test.go b/aws/retry/jitter_backoff_test.go
index 10951b3..d762a6a 100644
--- a/aws/retry/jitter_backoff_test.go
+++ b/aws/retry/jitter_backoff_test.go
@@ -38,7 +38,7 @@ func TestExponentialJitterBackoff_AttemptDelay(t *testing.T) {
"max delay": {
MaxBackoff: 20 * time.Second,
RandFloat: func() (float64, error) { return maxB, nil },
- Attempt: 1 << 53,
+ Attempt: math.MaxInt32,
Expect: timeconv.FloatSecondsDur(maxB * math.Exp2(math.Log2(20))),
},
}
diff --git a/service/internal/benchmark/dynamodb/customizations_test.go b/service/internal/benchmark/dynamodb/customizations_test.go
index 8ec0799..ff49056 100644
--- a/service/internal/benchmark/dynamodb/customizations_test.go
+++ b/service/internal/benchmark/dynamodb/customizations_test.go
@@ -25,8 +25,8 @@ import (
type testData struct {
filename string
- respChecksum int
- respGzipChecksum int
+ respChecksum int64
+ respGzipChecksum int64
}
func BenchmarkCustomizations(b *testing.B) {
@@ -71,7 +71,7 @@ func benchCustomizationsOld(b *testing.B, c testData) {
r.HTTPResponse = &http.Response{
StatusCode: 200,
Header: http.Header{
- "X-Amz-Crc32": []string{strconv.Itoa(c.respChecksum)},
+ "X-Amz-Crc32": []string{strconv.FormatInt(c.respChecksum, 10)},
},
ContentLength: int64(len(body)),
Body: ioutil.NopCloser(bytes.NewReader(body)),
@@ -127,7 +127,7 @@ func benchCustomizationsSmithy(b *testing.B, c testData) {
Region: "us-west-2",
Credentials: unit.StubCredentialsProvider{},
HTTPClient: &mockClient{
- ChecksumHeaderValue: []string{strconv.Itoa(c.respChecksum)},
+ ChecksumHeaderValue: []string{strconv.FormatInt(c.respChecksum, 10)},
ScanRespBody: body,
},
}
@@ -141,7 +141,7 @@ func benchCustomizationsSmithy(b *testing.B, c testData) {
b.Run("all enabled", func(b *testing.B) {
client := dynamodb.New(options, func(o *dynamodb.Options) {
o.HTTPClient = &mockClient{
- ChecksumHeaderValue: []string{strconv.Itoa(c.respGzipChecksum)},
+ ChecksumHeaderValue: []string{strconv.FormatInt(c.respGzipChecksum, 10)},
ScanRespGzipBody: gzipBody,
}
o.DisableValidateResponseChecksum = false
|