From 3ad0dc453f803bce53344aba9be8be0ac199ed69 Mon Sep 17 00:00:00 2001 From: Jason Del Ponte <961963+jasdel@users.noreply.github.com> Date: Fri, 21 Jan 2022 10:14:18 -0800 Subject: [PATCH] config: add test case for role_duration_seconds parameter. --- config/shared_config_test.go | 12 +++++++++--- config/testdata/shared_config | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/config/shared_config_test.go b/config/shared_config_test.go index f5195ecb4f5..3fb8960ac9d 100644 --- a/config/shared_config_test.go +++ b/config/shared_config_test.go @@ -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{ @@ -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) } }) } diff --git a/config/testdata/shared_config b/config/testdata/shared_config index ee2c7b9961c..dc3886ba455 100644 --- a/config/testdata/shared_config +++ b/config/testdata/shared_config @@ -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