Skip to content

Commit

Permalink
Merge branch 'master' of github.com:aws/aws-sdk-go into version_maint…
Browse files Browse the repository at this point in the history
…enance
  • Loading branch information
KaibaLopez committed Dec 10, 2020
2 parents 3f791a6 + bc1b6bc commit 0ec19bd
Show file tree
Hide file tree
Showing 20 changed files with 11,161 additions and 254 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Release v1.36.6 (2020-12-10)
===

### Service Client Updates
* `service/ec2`: Updates service API, documentation, and paginators
* TGW connect simplifies connectivity of SD-WAN appliances; IGMP support for TGW multicast; VPC Reachability Analyzer for VPC resources connectivity analysis.
* `service/kendra`: Updates service API and documentation
* Amazon Kendra now supports adding synonyms to an index through the new Thesaurus resource.
* `service/networkmanager`: Updates service API, documentation, and paginators

Release v1.36.5 (2020-12-09)
===

Expand Down
122 changes: 101 additions & 21 deletions aws/request/retryer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,99 @@ package request
import (
"errors"
"fmt"
"net/http"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/client/metadata"
)

func TestRequestThrottling(t *testing.T) {
req := Request{}
func TestRequestIsErrorThrottle(t *testing.T) {
cases := []struct {
ecode string
Err error
Throttle bool
Req Request
}{
{
ecode: "ProvisionedThroughputExceededException",
Err: awserr.New("ProvisionedThroughputExceededException", "", nil),
Throttle: true,
},
{
ecode: "ThrottledException",
Err: awserr.New("ThrottledException", "", nil),
Throttle: true,
},
{
ecode: "Throttling",
Err: awserr.New("Throttling", "", nil),
Throttle: true,
},
{
ecode: "ThrottlingException",
Err: awserr.New("ThrottlingException", "", nil),
Throttle: true,
},
{
ecode: "RequestLimitExceeded",
Err: awserr.New("RequestLimitExceeded", "", nil),
Throttle: true,
},
{
ecode: "RequestThrottled",
Err: awserr.New("RequestThrottled", "", nil),
Throttle: true,
},
{
ecode: "TooManyRequestsException",
Err: awserr.New("TooManyRequestsException", "", nil),
Throttle: true,
},
{
ecode: "PriorRequestNotComplete",
Err: awserr.New("PriorRequestNotComplete", "", nil),
Throttle: true,
},
{
ecode: "TransactionInProgressException",
Err: awserr.New("TransactionInProgressException", "", nil),
Throttle: true,
},
{
ecode: "EC2ThrottledException",
Err: awserr.New("EC2ThrottledException", "", nil),
Throttle: true,
},
{
Err: awserr.NewRequestFailure(
awserr.New(ErrCodeSerialization, "some error",
awserr.NewUnmarshalError(nil, "blah", []byte{}),
),
503,
"request-id",
),
Req: Request{
HTTPResponse: &http.Response{
StatusCode: 503,
Header: http.Header{},
},
},
Throttle: true,
},
{
Err: awserr.NewRequestFailure(
awserr.New(ErrCodeSerialization, "some error",
awserr.NewUnmarshalError(nil, "blah", []byte{}),
),
400,
"request-id",
),
Req: Request{
HTTPResponse: &http.Response{
StatusCode: 400,
Header: http.Header{},
},
},
Throttle: false,
},
}

for _, c := range cases {
req.Error = awserr.New(c.ecode, "", nil)
if e, a := true, req.IsErrorThrottle(); e != a {
t.Errorf("expect %s to be throttled, was %t", c.ecode, a)
for i, c := range cases {
req := c.Req
req.Error = c.Err
if e, a := c.Throttle, req.IsErrorThrottle(); e != a {
t.Errorf("%d, expect %v to be throttled, was %t", i, c.Err, a)
}
}
}
Expand All @@ -64,9 +109,10 @@ func (e mockTempError) Temporary() bool {
return bool(e)
}

func TestIsErrorRetryable(t *testing.T) {
func TestRequestIsErrorRetryable(t *testing.T) {
cases := []struct {
Err error
Req Request
Retryable bool
}{
{
Expand All @@ -81,6 +127,38 @@ func TestIsErrorRetryable(t *testing.T) {
Err: awserr.New(ErrCodeSerialization, "some error", errors.New("blah")),
Retryable: true,
},
{
Err: awserr.NewRequestFailure(
awserr.New(ErrCodeSerialization, "some error",
awserr.NewUnmarshalError(nil, "blah", []byte{}),
),
503,
"request-id",
),
Req: Request{
HTTPResponse: &http.Response{
StatusCode: 503,
Header: http.Header{},
},
},
Retryable: false, // classified as throttled not retryable
},
{
Err: awserr.NewRequestFailure(
awserr.New(ErrCodeSerialization, "some error",
awserr.NewUnmarshalError(nil, "blah", []byte{}),
),
400,
"request-id",
),
Req: Request{
HTTPResponse: &http.Response{
StatusCode: 400,
Header: http.Header{},
},
},
Retryable: false,
},
{
Err: awserr.New("SomeError", "some error", nil),
Retryable: false,
Expand All @@ -96,9 +174,11 @@ func TestIsErrorRetryable(t *testing.T) {
}

for i, c := range cases {
retryable := IsErrorRetryable(c.Err)
if e, a := c.Retryable, retryable; e != a {
t.Errorf("%d, expect %t temporary error, got %t", i, e, a)
req := c.Req
req.Error = c.Err

if e, a := c.Retryable, req.IsErrorRetryable(); e != a {
t.Errorf("%d, expect %v to be retryable, was %t", i, c.Err, a)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion aws/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ package aws
const SDKName = "aws-sdk-go"

// SDKVersion is the version of this SDK
const SDKVersion = "1.36.5"
const SDKVersion = "1.36.6"
Loading

0 comments on commit 0ec19bd

Please sign in to comment.