Skip to content

Commit 9c64bb3

Browse files
authored
Merge pull request #296 from synfinatic/more-test
More unit tests
2 parents d46eb43 + abb26d5 commit 9c64bb3

File tree

4 files changed

+362
-72
lines changed

4 files changed

+362
-72
lines changed

sso/awssso.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,7 @@ func (as *AWSSSO) GetRoles(account AccountInfo) ([]RoleInfo, error) {
170170
func (as *AWSSSO) makeRoleInfo(account AccountInfo, i int, r types.RoleInfo) error {
171171
var via string
172172

173-
aId, err := strconv.ParseInt(account.AccountId, 10, 64)
174-
if err != nil {
175-
return fmt.Errorf("Unable to parse accountid %s: %s",
176-
account.AccountId, err.Error())
177-
}
173+
aId, _ := strconv.ParseInt(account.AccountId, 10, 64)
178174
ssoRole, err := as.SSOConfig.GetRole(aId, aws.ToString(r.RoleName))
179175
if err != nil && len(ssoRole.Via) > 0 {
180176
via = ssoRole.Via
@@ -208,7 +204,10 @@ func (ai AccountInfo) GetHeader(fieldName string) (string, error) {
208204
func (ai AccountInfo) GetAccountId64() int64 {
209205
i64, err := strconv.ParseInt(ai.AccountId, 10, 64)
210206
if err != nil {
211-
log.WithError(err).Fatalf("Invalid AWS AccountID from AWS SSO: %s", ai.AccountId)
207+
log.WithError(err).Panicf("Invalid AWS AccountID from AWS SSO: %s", ai.AccountId)
208+
}
209+
if i64 < 0 {
210+
log.WithError(err).Panicf("AWS AccountID must be >= 0: %s", ai.AccountId)
212211
}
213212
return i64
214213
}

0 commit comments

Comments
 (0)