Skip to content

Commit

Permalink
verify second entry data in test
Browse files Browse the repository at this point in the history
  • Loading branch information
kpcraig committed May 2, 2024
1 parent abe66d7 commit 750ced2
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion builtin/credential/aws/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 750ced2

Please sign in to comment.