Skip to content

Commit

Permalink
Adds additional tests for IMDS region
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Feb 23, 2022
1 parent 72c9b6d commit b5b7fa3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions aws_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,16 @@ region = us-east-1
ExpectedRegion: "us-east-1",
},

"config overrides IMDS": {
Config: &Config{
AccessKey: servicemocks.MockStaticAccessKey,
SecretKey: servicemocks.MockStaticSecretKey,
Region: "us-west-2",
},
IMDSRegion: "us-east-1",
ExpectedRegion: "us-west-2",
},

"AWS_REGION overrides shared configuration": {
Config: &Config{
AccessKey: servicemocks.MockStaticAccessKey,
Expand Down Expand Up @@ -1306,6 +1316,18 @@ region = us-west-2
`,
ExpectedRegion: "us-east-1",
},

"AWS_REGION overrides IMDS": {
Config: &Config{
AccessKey: servicemocks.MockStaticAccessKey,
SecretKey: servicemocks.MockStaticSecretKey,
},
EnvironmentVariables: map[string]string{
"AWS_REGION": "us-east-1",
},
IMDSRegion: "us-west-2",
ExpectedRegion: "us-east-1",
},
}

for testName, testCase := range testCases {
Expand Down

0 comments on commit b5b7fa3

Please sign in to comment.