Skip to content

Commit

Permalink
Adds tests confirming service endpoint set on Config overrides base…
Browse files Browse the repository at this point in the history
… endpoint from envvar or config file
  • Loading branch information
gdavison committed Dec 11, 2023
1 parent a355034 commit 92e7c3f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions aws_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3112,6 +3112,17 @@ func TestStsEndpoint(t *testing.T) {
ExpectedCredentials: mockdata.MockStaticCredentials,
},

"service config overrides base envvar": {
Config: Config{
AccessKey: servicemocks.MockStaticAccessKey,
Region: "us-east-1",
SecretKey: servicemocks.MockStaticSecretKey,
},
SetServiceEndpoint: setValid,
SetInvalidEnv: "AWS_ENDPOINT_URL",
ExpectedCredentials: mockdata.MockStaticCredentials,
},

"service config overrides service config_file": {
Config: Config{
Profile: "default",
Expand All @@ -3134,6 +3145,24 @@ sts =
},
},

"service config overrides base config_file": {
Config: Config{
Profile: "default",
},
ConfigFile: `
[default]
aws_access_key_id = DefaultSharedCredentialsAccessKey
aws_secret_access_key = DefaultSharedCredentialsSecretKey
endpoint_url = %[2]s
`,
SetServiceEndpoint: setValid,
ExpectedCredentials: aws.Credentials{
AccessKeyID: "DefaultSharedCredentialsAccessKey",
SecretAccessKey: "DefaultSharedCredentialsSecretKey",
Source: sharedConfigCredentialsProvider,
},
},

"service envvar": {
Config: Config{
AccessKey: servicemocks.MockStaticAccessKey,
Expand Down

0 comments on commit 92e7c3f

Please sign in to comment.