Skip to content

Commit

Permalink
Adds tests to ensure service endpoint set on Config overrides envva…
Browse files Browse the repository at this point in the history
…r or config file
  • Loading branch information
gdavison committed Dec 11, 2023
1 parent 9afea94 commit a355034
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion aws_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3091,7 +3091,7 @@ func TestStsEndpoint(t *testing.T) {
ConfigFile string
ExpectedCredentials aws.Credentials
}{
"config": {
"service config": {
Config: Config{
AccessKey: servicemocks.MockStaticAccessKey,
Region: "us-east-1",
Expand All @@ -3101,6 +3101,39 @@ func TestStsEndpoint(t *testing.T) {
ExpectedCredentials: mockdata.MockStaticCredentials,
},

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

"service config overrides service config_file": {
Config: Config{
Profile: "default",
},
ConfigFile: `
[default]
aws_access_key_id = DefaultSharedCredentialsAccessKey
aws_secret_access_key = DefaultSharedCredentialsSecretKey
services = sts-test
[services sts-test]
sts =
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 a355034

Please sign in to comment.