Skip to content

Commit

Permalink
Uses net.OpError for network error testing
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Sep 15, 2021
1 parent de4c91c commit a49aa13
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"io/ioutil"
"net"
"os"
"reflect"
"runtime"
Expand Down Expand Up @@ -1239,42 +1240,42 @@ func TestSessionRetryHandlers(t *testing.T) {
{
Description: "send request no such host failed under MaxNetworkRetryCount",
RetryCount: MaxNetworkRetryCount - 1,
Error: awserr.New(request.ErrCodeRequestError, "send request failed", errors.New("no such host")),
Error: awserr.New(request.ErrCodeRequestError, "send request failed", &net.OpError{Op: "dial", Err: errors.New("no such host")}),
ExpectedRetryableValue: true,
ExpectRetryToBeAttempted: true,
},
{
Description: "send request no such host failed over MaxNetworkRetryCount",
RetryCount: MaxNetworkRetryCount,
Error: awserr.New(request.ErrCodeRequestError, "send request failed", errors.New("no such host")),
Error: awserr.New(request.ErrCodeRequestError, "send request failed", &net.OpError{Op: "dial", Err: errors.New("no such host")}),
ExpectedRetryableValue: false,
ExpectRetryToBeAttempted: false,
},
{
Description: "send request connection refused failed under MaxNetworkRetryCount",
RetryCount: MaxNetworkRetryCount - 1,
Error: awserr.New(request.ErrCodeRequestError, "send request failed", errors.New("connection refused")),
Error: awserr.New(request.ErrCodeRequestError, "send request failed", &net.OpError{Op: "dial", Err: errors.New("connection refused")}),
ExpectedRetryableValue: true,
ExpectRetryToBeAttempted: true,
},
{
Description: "send request connection refused failed over MaxNetworkRetryCount",
RetryCount: MaxNetworkRetryCount,
Error: awserr.New(request.ErrCodeRequestError, "send request failed", errors.New("connection refused")),
Error: awserr.New(request.ErrCodeRequestError, "send request failed", &net.OpError{Op: "dial", Err: errors.New("connection refused")}),
ExpectedRetryableValue: false,
ExpectRetryToBeAttempted: false,
},
{
Description: "send request other error failed under MaxNetworkRetryCount",
RetryCount: MaxNetworkRetryCount - 1,
Error: awserr.New(request.ErrCodeRequestError, "send request failed", errors.New("other error")),
Error: awserr.New(request.ErrCodeRequestError, "send request failed", &net.OpError{Op: "dial", Err: errors.New("other error")}),
ExpectedRetryableValue: true,
ExpectRetryToBeAttempted: true,
},
{
Description: "send request other error failed over MaxNetworkRetryCount",
RetryCount: MaxNetworkRetryCount,
Error: awserr.New(request.ErrCodeRequestError, "send request failed", errors.New("other error")),
Error: awserr.New(request.ErrCodeRequestError, "send request failed", &net.OpError{Op: "dial", Err: errors.New("other error")}),
ExpectedRetryableValue: true,
ExpectRetryToBeAttempted: true,
},
Expand Down

0 comments on commit a49aa13

Please sign in to comment.