Skip to content

Commit

Permalink
remove unused 'region' variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jihunseol authored and jdn5126 committed Mar 27, 2023
1 parent 117c84a commit aae8f68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pkg/awsutils/awssession/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ func New() *session.Session {
customResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) {
if service == ec2.EndpointsID {
return endpoints.ResolvedEndpoint{
URL: endpoint,
SigningRegion: region,
URL: endpoint,
}, nil
}
return endpoints.DefaultResolver().EndpointFor(service, region, optFns...)
Expand Down
4 changes: 1 addition & 3 deletions pkg/awsutils/awssession/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ func TestHttpTimeoutWithValueAbove10(t *testing.T) {

func TestAwsEc2EndpointResolver(t *testing.T) {
customEndpoint := "https://ec2.us-west-2.customaws.com"
region := "us-west-2"

os.Setenv("AWS_EC2_ENDPOINT", customEndpoint)
defer os.Unsetenv("AWS_EC2_ENDPOINT")

sess := New()

resolvedEndpoint, err := sess.Config.EndpointResolver.EndpointFor(ec2.EndpointsID, region)
resolvedEndpoint, err := sess.Config.EndpointResolver.EndpointFor(ec2.EndpointsID, "")
assert.NoError(t, err)
assert.Equal(t, customEndpoint, resolvedEndpoint.URL)
assert.Equal(t, region, resolvedEndpoint.SigningRegion)
}

0 comments on commit aae8f68

Please sign in to comment.