From 750ced2b49337eb988292d7fbbe820b82d85ec11 Mon Sep 17 00:00:00 2001 From: Kay Craig Date: Thu, 2 May 2024 12:35:04 -0400 Subject: [PATCH] verify second entry data in test --- builtin/credential/aws/backend_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/builtin/credential/aws/backend_test.go b/builtin/credential/aws/backend_test.go index 5d4a1760b60d..771dc0e31140 100644 --- a/builtin/credential/aws/backend_test.go +++ b/builtin/credential/aws/backend_test.go @@ -1409,7 +1409,7 @@ func TestBackend_pathStsConfig(t *testing.T) { } data2 := map[string]interface{}{ - "sts_role": "arn:aws:iam:account1:role/myRole", + "sts_role": "arn:aws:iam:account2:role/myRole2", "external_id": "fake_id", } @@ -1453,6 +1453,21 @@ func TestBackend_pathStsConfig(t *testing.T) { t.Fatal(err) } + // test second read + stsReq.Operation = logical.ReadOperation + resp, err = b.HandleRequest(context.Background(), stsReq) + if err != nil { + t.Fatal(err) + } + expectedStsRole = "arn:aws:iam:account2:role/myRole2" + expectedExternalID := "fake_id" + if resp.Data["sts_role"].(string) != expectedStsRole { + t.Fatalf("bad: expected:%s\n got:%s\n", expectedStsRole, resp.Data["sts_role"].(string)) + } + if resp.Data["external_id"].(string) != expectedExternalID { + t.Fatalf("bad: expected:%s\n got:%s\n", expectedExternalID, resp.Data["external_id"].(string)) + } + stsReq.Operation = logical.ListOperation stsReq.Path = "config/sts" // test list operation