From fbe0ffb1978d5b216f091931d06eca4d2f115d03 Mon Sep 17 00:00:00 2001 From: Subhobrata Dey Date: Fri, 24 Nov 2023 21:38:08 +0000 Subject: [PATCH] fix flaky security tests in alerting Signed-off-by: Subhobrata Dey --- .../opensearch/alerting/resthandler/SecureWorkflowRestApiIT.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/SecureWorkflowRestApiIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/SecureWorkflowRestApiIT.kt index c0e6762e7..25b49d3dd 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/SecureWorkflowRestApiIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/SecureWorkflowRestApiIT.kt @@ -397,6 +397,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() { assertEquals("Get workflow failed", RestStatus.FORBIDDEN.status, e.response.statusLine.statusCode) } finally { deleteRoleAndRoleMapping(TEST_HR_ROLE) + deleteRoleMapping(ALERTING_FULL_ACCESS_ROLE) deleteUser(getUser) getUserClient?.close() } @@ -447,6 +448,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() { } catch (e: ResponseException) { assertEquals("Create workflow failed", RestStatus.FORBIDDEN.status, e.response.statusLine.statusCode) } finally { + deleteRoleMapping(ALERTING_FULL_ACCESS_ROLE) deleteUser(userWithDifferentRole) userWithDifferentRoleClient?.close() } @@ -1104,6 +1106,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() { assertEquals("Delete workflow failed", RestStatus.OK, response?.restStatus()) } finally { deleteRoleAndRoleMapping(TEST_HR_ROLE) + deleteRoleMapping(ALERTING_FULL_ACCESS_ROLE) deleteUser(deleteUser) deleteUserClient?.close() }