Skip to content

Commit

Permalink
config: add test case for role_duration_seconds parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasdel committed Jan 21, 2022
1 parent 6625113 commit 3ad0dc4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 9 additions & 3 deletions config/shared_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,12 @@ func TestLoadSharedConfigFromSection(t *testing.T) {
Profile: "profile partial_creds",
Expected: SharedConfig{},
},
"profile with role duration": {
Profile: "profile with_role_duration",
Expected: SharedConfig{
RoleDurationSeconds: aws.Duration(3601 * time.Second),
},
},
"profile with complete creds": {
Profile: "profile complete_creds",
Expected: SharedConfig{
Expand Down Expand Up @@ -689,12 +695,12 @@ func TestLoadSharedConfigFromSection(t *testing.T) {
}
return
}

if err != nil {
t.Fatalf("expect no error, got %v", err)
}
if e, a := c.Expected, cfg; !reflect.DeepEqual(e, a) {
t.Errorf("expect %v, got %v", e, a)

if diff := cmp.Diff(c.Expected, cfg); diff != "" {
t.Errorf("expect shared config match\n%s", diff)
}
})
}
Expand Down
3 changes: 3 additions & 0 deletions config/testdata/shared_config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ aws_secret_access_key = SECRET
[profile alt_profile_name]
region = alt_profile_name_region

[profile with_role_duration]
duration_seconds = 3601

[profile short_profile_name_first]
region = short_profile_name_first_short

Expand Down

0 comments on commit 3ad0dc4

Please sign in to comment.