-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update aws-sdk-go and change way to get regional sts endpoint (#466)
- Loading branch information
Showing
6 changed files
with
124 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package api | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func getMockEC2Wrapper() ec2Wrapper { | ||
return ec2Wrapper{} | ||
} | ||
func Test_getRegionalStsEndpoint(t *testing.T) { | ||
|
||
ec2Wapper := getMockEC2Wrapper() | ||
|
||
type args struct { | ||
partitionID string | ||
region string | ||
} | ||
|
||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "service doesn't exist in partition", | ||
args: args{ | ||
partitionID: "aws-iso-f", | ||
region: "testregions", | ||
}, | ||
want: "https://sts.testregions.csp.hci.ic.gov", | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "region doesn't exist in partition", | ||
args: args{ | ||
partitionID: "aws", | ||
region: "us-test-2", | ||
}, | ||
want: "https://sts.us-test-2.amazonaws.com", | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "region and service exist in partition", | ||
args: args{ | ||
partitionID: "aws", | ||
region: "us-west-2", | ||
}, | ||
want: "https://sts.us-west-2.amazonaws.com", | ||
wantErr: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := ec2Wapper.getRegionalStsEndpoint(tt.args.partitionID, tt.args.region) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("getRegionalStsEndpoint() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
if got.URL != tt.want { | ||
t.Errorf("getRegionalStsEndpoint() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters