Skip to content

Commit

Permalink
Add a test with roles mapping specifying only user (#193)
Browse files Browse the repository at this point in the history
Signed-off-by: Rupa Lahiri <[email protected]>
  • Loading branch information
rblcoder authored Jun 7, 2024
1 parent 3699cfb commit 96ce4bf
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions provider/resource_opensearch_roles_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ func TestAccOpensearchOpenDistroRolesMapping(t *testing.T) {
Providers: testAccOpendistroProviders,
CheckDestroy: testAccCheckOpensearchRolesMappingDestroy,
Steps: []resource.TestStep{
{
Config: testAccOpenDistroRoleMappingTestOnlyUser(randomName),
Check: resource.ComposeTestCheckFunc(
testCheckOpensearchRolesMappingExists("opensearch_roles_mapping.test"),
resource.TestCheckResourceAttr(
"opensearch_roles_mapping.test",
"id",
"readall",
),
resource.TestCheckResourceAttr(
"opensearch_roles_mapping.test",
"users.#",
"1",
),
resource.TestCheckResourceAttr(
"opensearch_roles_mapping.test",
"description",
randomName,
),
),
},
{
Config: testAccOpenDistroRolesMappingResource(randomName),
Check: resource.ComposeTestCheckFunc(
Expand Down Expand Up @@ -128,3 +149,17 @@ resource "opensearch_roles_mapping" "test" {
}
`, resourceName)
}

func testAccOpenDistroRoleMappingTestOnlyUser(resourceName string) string {
return fmt.Sprintf(`
resource "opensearch_roles_mapping" "test" {
role_name = "readall"
users = [
"admin",
]
description = "%s"
}
`, resourceName)
}

0 comments on commit 96ce4bf

Please sign in to comment.