Skip to content

Commit

Permalink
fixup s3 upload and download manager tests for EndpointResolverOption…
Browse files Browse the repository at this point in the history
…s name change
  • Loading branch information
jasdel committed Oct 25, 2020
1 parent 56aa7f1 commit 045c367
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions feature/s3/manager/bucket_region_test.go
Expand Up @@ -67,7 +67,7 @@ func TestGetBucketRegion_Exists(t *testing.T) {
server := testSetupGetBucketRegionServer(c.RespRegion, c.StatusCode, true)

client := s3.New(s3.Options{
EndpointResolver: s3testing.EndpointResolverFunc(func(region string, options s3.ResolverOptions) (aws.Endpoint, error) {
EndpointResolver: s3testing.EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) {
return aws.Endpoint{
URL: server.URL,
}, nil
Expand Down Expand Up @@ -95,7 +95,7 @@ func TestGetBucketRegion_NotExists(t *testing.T) {
defer server.Close()

client := s3.New(s3.Options{
EndpointResolver: s3testing.EndpointResolverFunc(func(region string, options s3.ResolverOptions) (aws.Endpoint, error) {
EndpointResolver: s3testing.EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) {
return aws.Endpoint{
URL: server.URL,
}, nil
Expand Down
4 changes: 3 additions & 1 deletion feature/s3/manager/download_test.go
Expand Up @@ -464,7 +464,9 @@ func TestDownloadPartBodyRetry_FailRetry(t *testing.T) {
}

func TestDownloadWithContextCanceled(t *testing.T) {
d := manager.NewDownloader(s3.New(s3.Options{}))
d := manager.NewDownloader(s3.New(s3.Options{
Region: "mock-region",
}))

params := s3.GetObjectInput{
Bucket: aws.String("bucket"),
Expand Down
6 changes: 3 additions & 3 deletions feature/s3/manager/go.mod
Expand Up @@ -3,10 +3,10 @@ module github.com/aws/aws-sdk-go-v2/feature/s3/manager
go 1.15

require (
github.com/aws/aws-sdk-go-v2 v0.27.0
github.com/aws/aws-sdk-go-v2 v0.27.1-0.20201025222213-56aa7f14b50a
github.com/aws/aws-sdk-go-v2/config v0.2.0
github.com/aws/aws-sdk-go-v2/service/s3 v0.27.0
github.com/awslabs/smithy-go v0.2.0
github.com/aws/aws-sdk-go-v2/service/s3 v0.27.1-0.20201025222213-56aa7f14b50a
github.com/awslabs/smithy-go v0.2.1-0.20201023170655-5964f226ab39
github.com/google/go-cmp v0.4.1
)

Expand Down
3 changes: 3 additions & 0 deletions feature/s3/manager/go.sum
Expand Up @@ -3,6 +3,9 @@ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v0.0.0-20200930084
github.com/awslabs/smithy-go v0.1.0/go.mod h1:hPOQwnmBLHsUphH13tVSjQhTAFma0/0XoZGbBcOuABI=
github.com/awslabs/smithy-go v0.2.0 h1:lXzqqSYp5pLdLyjo4OMkyS57RrZIFPwkOayjqnBA02I=
github.com/awslabs/smithy-go v0.2.0/go.mod h1:hPOQwnmBLHsUphH13tVSjQhTAFma0/0XoZGbBcOuABI=
github.com/awslabs/smithy-go v0.2.1-0.20201022201941-77c3d28fb123/go.mod h1:hPOQwnmBLHsUphH13tVSjQhTAFma0/0XoZGbBcOuABI=
github.com/awslabs/smithy-go v0.2.1-0.20201023170655-5964f226ab39 h1:vt3BftT5WSNBjgSNqzgz8UrH/Xc758F3oZnBVjj4rpA=
github.com/awslabs/smithy-go v0.2.1-0.20201023170655-5964f226ab39/go.mod h1:hPOQwnmBLHsUphH13tVSjQhTAFma0/0XoZGbBcOuABI=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.4.1 h1:/exdXoGamhu5ONeUJH0deniYLWYvQwW66yvlfiiKTu0=
Expand Down
4 changes: 2 additions & 2 deletions feature/s3/manager/internal/testing/endpoints.go
Expand Up @@ -6,9 +6,9 @@ import (
)

// EndpointResolverFunc is a mock s3 endpoint resolver that wraps the given function
type EndpointResolverFunc func(region string, options s3.ResolverOptions) (aws.Endpoint, error)
type EndpointResolverFunc func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error)

// ResolveEndpoint returns the results from the wrapped function.
func (m EndpointResolverFunc) ResolveEndpoint(region string, options s3.ResolverOptions) (aws.Endpoint, error) {
func (m EndpointResolverFunc) ResolveEndpoint(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) {
return m(region, options)
}
3 changes: 2 additions & 1 deletion feature/s3/manager/upload_test.go
Expand Up @@ -741,6 +741,7 @@ func TestSSE(t *testing.T) {
func TestUploadWithContextCanceled(t *testing.T) {
u := manager.NewUploader(s3.New(s3.Options{
UsePathStyle: true,
Region: "mock-region",
}))

params := s3.PutObjectInput{
Expand Down Expand Up @@ -878,7 +879,7 @@ func TestUploadRetry(t *testing.T) {
defer server.Close()

client := s3.New(s3.Options{
EndpointResolver: s3testing.EndpointResolverFunc(func(region string, options s3.ResolverOptions) (aws.Endpoint, error) {
EndpointResolver: s3testing.EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) {
return aws.Endpoint{
URL: server.URL,
}, nil
Expand Down

0 comments on commit 045c367

Please sign in to comment.