Skip to content

Commit

Permalink
Allows setting either valid or invalid endpoint on Config
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Dec 11, 2023
1 parent 1eb55a9 commit 9afea94
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions aws_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3076,11 +3076,17 @@ web_identity_token_file = no-such-file
}

func TestStsEndpoint(t *testing.T) {
type settype int
const (
setNone settype = iota
setValid
setInvalid
)
testcases := map[string]struct {
Config Config
SetConfig bool
SetEnv string
SetInvalidEnv string
Config Config
SetServiceEndpoint settype
SetEnv string
SetInvalidEnv string
// Use string at index 1 for valid endpoint url and index 2 for invalid endpoint url
ConfigFile string
ExpectedCredentials aws.Credentials
Expand All @@ -3091,7 +3097,7 @@ func TestStsEndpoint(t *testing.T) {
Region: "us-east-1",
SecretKey: servicemocks.MockStaticSecretKey,
},
SetConfig: true,
SetServiceEndpoint: setValid,
ExpectedCredentials: mockdata.MockStaticCredentials,
},

Expand Down Expand Up @@ -3287,7 +3293,7 @@ endpoint_url = %[2]s
defer invalidTS.Close()
stsInvalidEndpoint := invalidTS.URL

if testcase.SetConfig {
if testcase.SetServiceEndpoint == setValid {
testcase.Config.StsEndpoint = stsEndpoint
}
if testcase.SetEnv != "" {
Expand Down

0 comments on commit 9afea94

Please sign in to comment.