kinesis-consumer/store/ddb/retryer_test.go

24 lines
768 B
Go
Raw Normal View History

2018-11-08 02:53:00 +00:00
package ddb
import (
"testing"
2021-09-22 05:00:14 +00:00
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
2018-11-08 02:53:00 +00:00
)
func TestDefaultRetyer(t *testing.T) {
2021-09-22 05:00:14 +00:00
retryableError := &types.ProvisionedThroughputExceededException{Message: aws.String("error not retryable")}
2018-11-08 02:53:00 +00:00
// retryer is not nil and should returns according to what error is passed in.
q := &DefaultRetryer{}
if q.ShouldRetry(retryableError) != true {
t.Errorf("expected ShouldRetry returns %v. got %v", false, q.ShouldRetry(retryableError))
}
2021-09-22 05:00:14 +00:00
nonRetryableError := &types.BackupInUseException{Message: aws.String("error not retryable")}
2018-11-08 02:53:00 +00:00
shouldRetry := q.ShouldRetry(nonRetryableError)
if shouldRetry != false {
t.Errorf("expected ShouldRetry returns %v. got %v", true, shouldRetry)
}
}