From 760513e556846c96166460c56753607907e8f5fe Mon Sep 17 00:00:00 2001 From: yubonluo <15242088755@163.com> Date: Tue, 12 Mar 2024 14:35:57 +0800 Subject: [PATCH 1/4] add FT setup --- .github/workflows/workspace-workflow.yml | 32 ++++++++++++++++++++++++ cypress.json | 3 ++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/workspace-workflow.yml diff --git a/.github/workflows/workspace-workflow.yml b/.github/workflows/workspace-workflow.yml new file mode 100644 index 000000000..e46d3cf99 --- /dev/null +++ b/.github/workflows/workspace-workflow.yml @@ -0,0 +1,32 @@ +name: Workspace Release tests workflow in Bundled OpenSearch Dashboards +on: + pull_request: + branches: ['**'] + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + tests: ${{ steps.filter.outputs.tests }} + steps: + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + tests: + - 'cypress/**/dashboards-workspace/**' + tests-with-security: + needs: changes + if: ${{ needs.changes.outputs.tests == 'true' }} + uses: ./.github/workflows/release-e2e-workflow-template.yml + with: + test-name: dashboards workspace + test-command: env CYPRESS_DASHBOARDS_WORKSPACE_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-workspace/*' + tests-without-security: + needs: changes + if: ${{ needs.changes.outputs.tests == 'true' }} + uses: ./.github/workflows/release-e2e-workflow-template.yml + with: + test-name: dashboards workspace + test-command: env CYPRESS_DASHBOARDS_WORKSPACE_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-workspace/*' + security-enabled: false \ No newline at end of file diff --git a/cypress.json b/cypress.json index 2b6abb7db..79b672b30 100644 --- a/cypress.json +++ b/cypress.json @@ -21,6 +21,7 @@ "DATASOURCE_MANAGEMENT_ENABLED": false, "ML_COMMONS_DASHBOARDS_ENABLED": true, "WAIT_FOR_LOADER_BUFFER_MS": 0, - "DASHBOARDS_ASSISTANT_ENABLED": false + "DASHBOARDS_ASSISTANT_ENABLED": false, + "DASHBOARDS_WORKSPACE_ENABLED": false } } From f0eba44fed52de1a8c8e307e23377c5bf3f3623a Mon Sep 17 00:00:00 2001 From: yubonluo <15242088755@163.com> Date: Wed, 13 Mar 2024 12:01:55 +0800 Subject: [PATCH 2/4] add osd-serve-args --- .github/workflows/workspace-workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workspace-workflow.yml b/.github/workflows/workspace-workflow.yml index e46d3cf99..28d482afc 100644 --- a/.github/workflows/workspace-workflow.yml +++ b/.github/workflows/workspace-workflow.yml @@ -22,6 +22,7 @@ jobs: with: test-name: dashboards workspace test-command: env CYPRESS_DASHBOARDS_WORKSPACE_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-workspace/*' + osd-serve-args: --workspace.enabled=true --savedObjects.permission.enabled: true tests-without-security: needs: changes if: ${{ needs.changes.outputs.tests == 'true' }} @@ -29,4 +30,5 @@ jobs: with: test-name: dashboards workspace test-command: env CYPRESS_DASHBOARDS_WORKSPACE_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-workspace/*' + osd-serve-args: --workspace.enabled=true --savedObjects.permission.enabled: true security-enabled: false \ No newline at end of file From 6863eb5d73e3a42b94f4f4fd237b6a4330cb8737 Mon Sep 17 00:00:00 2001 From: yubonluo <15242088755@163.com> Date: Wed, 13 Mar 2024 13:47:13 +0800 Subject: [PATCH 3/4] fix error --- ...kspace-workflow.yml => workspace-release-e2e-workflow.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{workspace-workflow.yml => workspace-release-e2e-workflow.yml} (96%) diff --git a/.github/workflows/workspace-workflow.yml b/.github/workflows/workspace-release-e2e-workflow.yml similarity index 96% rename from .github/workflows/workspace-workflow.yml rename to .github/workflows/workspace-release-e2e-workflow.yml index 28d482afc..801b4d931 100644 --- a/.github/workflows/workspace-workflow.yml +++ b/.github/workflows/workspace-release-e2e-workflow.yml @@ -22,7 +22,7 @@ jobs: with: test-name: dashboards workspace test-command: env CYPRESS_DASHBOARDS_WORKSPACE_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-workspace/*' - osd-serve-args: --workspace.enabled=true --savedObjects.permission.enabled: true + osd-serve-args: --workspace.enabled=true --savedObjects.permission.enabled=true tests-without-security: needs: changes if: ${{ needs.changes.outputs.tests == 'true' }} @@ -30,5 +30,5 @@ jobs: with: test-name: dashboards workspace test-command: env CYPRESS_DASHBOARDS_WORKSPACE_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-workspace/*' - osd-serve-args: --workspace.enabled=true --savedObjects.permission.enabled: true + osd-serve-args: --workspace.enabled=true --savedObjects.permission.enabled=true security-enabled: false \ No newline at end of file From a7a39d6a1ddee3cdcdf71b75a968aded818a6ebd Mon Sep 17 00:00:00 2001 From: yubonluo <15242088755@163.com> Date: Wed, 13 Mar 2024 13:59:00 +0800 Subject: [PATCH 4/4] add integration test --- .../workspace_create.spec.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 cypress/integration/plugins/dashboards-workspace/workspace_create.spec.js diff --git a/cypress/integration/plugins/dashboards-workspace/workspace_create.spec.js b/cypress/integration/plugins/dashboards-workspace/workspace_create.spec.js new file mode 100644 index 000000000..f0599f6d2 --- /dev/null +++ b/cypress/integration/plugins/dashboards-workspace/workspace_create.spec.js @@ -0,0 +1,32 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { BASE_PATH } from '../../../utils/constants'; + +if (Cypress.env('DASHBOARDS_WORKSPACE_ENABLED')) { + describe('Workspace CRUD APIs', () => { + describe('Create a workspace', () => { + it('should successfully create a worksapce', () => { + const body = { + attributes: { + name: 'test_workspace', + description: 'test_workspace_description', + }, + }; + cy.request({ + method: 'POST', + url: `${BASE_PATH}/api/workspaces`, + headers: { + 'osd-xsrf': true, + }, + body: body, + }).as('createWorkspace'); + cy.get('@createWorkspace').should((res) => { + expect(res.body.success).to.eql(true); + }); + }); + }); + }); +}