From 79df57852cd8bf6b60f0cfd66c80be35feabf37a Mon Sep 17 00:00:00 2001 From: Lin Wang Date: Wed, 13 Nov 2024 15:12:38 +0800 Subject: [PATCH] Delete role mapping Signed-off-by: Lin Wang --- .../workspace-plugin/mds_workspace_detail.spec.js | 1 + .../utils/plugins/security-dashboards-plugin/commands.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_detail.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_detail.spec.js index 9bc7420f3..911f5cc15 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_detail.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_detail.spec.js @@ -51,6 +51,7 @@ if (Cypress.env('WORKSPACE_ENABLED')) { after(() => { cy.deleteWorkspaceById(workspaceId); if (Cypress.env('SECURITY_ENABLED')) { + cy.deleteRoleMapping(WORKSPACE_TEST_ROLE_NAME); cy.deleteInternalUser(NONE_DASHBOARDS_ADMIN_USERNAME); cy.deleteRole(WORKSPACE_TEST_ROLE_NAME); } diff --git a/cypress/utils/plugins/security-dashboards-plugin/commands.js b/cypress/utils/plugins/security-dashboards-plugin/commands.js index 8a407ec65..f711487f6 100644 --- a/cypress/utils/plugins/security-dashboards-plugin/commands.js +++ b/cypress/utils/plugins/security-dashboards-plugin/commands.js @@ -62,3 +62,11 @@ Cypress.Commands.add('createRoleMapping', (roleID, rolemappingJson) => { ); cy.wait(10000); }); + +Cypress.Commands.add('deleteRoleMapping', (roleID) => { + cy.request( + 'DELETE', + `${Cypress.env('openSearchUrl')}${SEC_API.ROLE_MAPPING_BASE}/${roleID}` + ); + cy.wait(10000); +});