From d63391c18c968e2481adf91fc4b2e069d17119ec Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Tue, 8 Apr 2025 12:28:11 +0530 Subject: [PATCH 01/15] Added Release Notes for v3.0.0-beta1 Signed-off-by: Vaibhav Agarwal --- ...ment-dashboards-plugin.release-notes-3.0.0.0-beta1.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 release-notes/opensearch-index-management-dashboards-plugin.release-notes-3.0.0.0-beta1.md diff --git a/release-notes/opensearch-index-management-dashboards-plugin.release-notes-3.0.0.0-beta1.md b/release-notes/opensearch-index-management-dashboards-plugin.release-notes-3.0.0.0-beta1.md new file mode 100644 index 000000000..445ee9492 --- /dev/null +++ b/release-notes/opensearch-index-management-dashboards-plugin.release-notes-3.0.0.0-beta1.md @@ -0,0 +1,9 @@ +## Version 3.0.0.0-beta1 2025-04-08 + +Compatible with OpenSearch 3.0.0-beta1 + +### Bug Fixes +* Fixed CVE: Updated elliptic dependency resolution ([#1290](https://github.com/opensearch-project/index-management-dashboards-plugin/pull/1290)) + +### Maintenance +* Updated 3.0.0 qualifier from alpha1 to beta1 ([#1293](https://github.com/opensearch-project/index-management-dashboards-plugin/pull/1293)) \ No newline at end of file From b1c29033510791b8b10b1e0a8745e6f2dddcb334 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Sun, 13 Apr 2025 02:22:14 +0530 Subject: [PATCH 02/15] Fixed E2E tests Signed-off-by: Vaibhav Agarwal --- .../{split_index.js => a_split_index.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cypress/e2e/plugins/index-management-dashboards-plugin/{split_index.js => a_split_index.js} (100%) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js similarity index 100% rename from cypress/e2e/plugins/index-management-dashboards-plugin/split_index.js rename to cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js From e607a82b0868656c704835092a5182b2d84e31cd Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Sun, 13 Apr 2025 04:44:03 +0530 Subject: [PATCH 03/15] Fixed split_index Signed-off-by: Vaibhav Agarwal --- babel.config.js | 9 +++++++++ .../index-management-dashboards-plugin/a_split_index.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/babel.config.js b/babel.config.js index 7c654bfa6..8c445f1b0 100644 --- a/babel.config.js +++ b/babel.config.js @@ -11,9 +11,17 @@ module.exports = function (api) { // Common plugins for all environments const commonPlugins = [require("@babel/plugin-proposal-nullish-coalescing-operator")]; + // Common configuration for all environments + const commonConfig = { + generatorOpts: { + maxSize: 1000000, // Increased size limit to handle larger files + }, + }; + // Test-specific configuration if (isTest) { return { + ...commonConfig, // Spread the common configuration presets: [require("@babel/preset-env"), require("@babel/preset-react"), require("@babel/preset-typescript")], plugins: [ [require("@babel/plugin-transform-runtime"), { regenerator: true }], @@ -27,6 +35,7 @@ module.exports = function (api) { // Build/dev configuration return { + ...commonConfig, // Spread the common configuration plugins: commonPlugins, }; }; diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index 676537174..1da364410 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -33,7 +33,7 @@ describe("Split Index", () => { // type field name cy.get('[placeholder="Specify a name for the new index."]').type(sampleIndex).end(); - cy.get('[data-test-subj="comboBoxSearchInput"]').focus().type(`${sampleAlias}`).end(); + cy.get('[data-test-subj="comboBoxSearchInput"]').focus().type(`${sampleAlias}{enter}`).end(); // click create cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true }).end(); From 176c926816713e5b5453711c64f298268001fea4 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Sun, 13 Apr 2025 15:35:35 +0530 Subject: [PATCH 04/15] Removed unreliable part of split_index Signed-off-by: Vaibhav Agarwal --- .../a_split_index.js | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index 1da364410..4e70656e0 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -12,8 +12,7 @@ describe("Split Index", () => { // Set welcome screen tracking to false localStorage.setItem("home:welcome:show", "false"); cy.deleteAllIndices(); - //let api call complete and delete all indices - cy.wait(6000); + cy.wait("@deleteIndices"); }); describe("can be created and updated", () => { @@ -41,20 +40,20 @@ describe("Split Index", () => { // The index should exist cy.get(`#_selection_column_${sampleIndex}-checkbox`).should("have.exist").end(); - cy.get(`[data-test-subj="viewIndexDetailButton-${sampleIndex}"]`, { timeout: 10000 }).click().end(); - cy.get("#indexDetailModalSettings").click().end(); - - cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').then(($shardNumber) => { - splitNumber = $shardNumber.attr("title") * 2; - }); - - cy.get("#indexDetailModalAlias").click().end(); - cy.get(`[title="${sampleAlias}"]`).should("exist").end(); - - // Update Index status to blocks write otherwise we can't apply split operation on it - cy.updateIndexSettings(sampleIndex, { - "index.blocks.write": "true", - }).end(); + // cy.get(`[data-test-subj="viewIndexDetailButton-${sampleIndex}"]`, { timeout: 10000 }).click().end(); + // cy.get("#indexDetailModalSettings").click().end(); + // + // cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').then(($shardNumber) => { + // splitNumber = $shardNumber.attr("title") * 2; + // }); + // + // cy.get("#indexDetailModalAlias").click().end(); + // cy.get(`[title="${sampleAlias}"]`).should("exist").end(); + // + // // Update Index status to blocks write otherwise we can't apply split operation on it + // cy.updateIndexSettings(sampleIndex, { + // "index.blocks.write": "true", + // }).end(); }); // create index it("Split successfully", () => { From 3c356d9028ca058fafd289fca87198e7b7f52537 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Sun, 13 Apr 2025 16:16:39 +0530 Subject: [PATCH 05/15] Remove @deleteIndices Signed-off-by: Vaibhav Agarwal --- .../plugins/index-management-dashboards-plugin/a_split_index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index 4e70656e0..3f517ff92 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -12,7 +12,6 @@ describe("Split Index", () => { // Set welcome screen tracking to false localStorage.setItem("home:welcome:show", "false"); cy.deleteAllIndices(); - cy.wait("@deleteIndices"); }); describe("can be created and updated", () => { From a44420ceb5038bad79041082402a9fc8a0ad234b Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Sun, 13 Apr 2025 17:31:33 +0530 Subject: [PATCH 06/15] fixed indices Signed-off-by: Vaibhav Agarwal --- .../index-management-dashboards-plugin/a_split_index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index 3f517ff92..60f56cd28 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -11,14 +11,13 @@ describe("Split Index", () => { before(() => { // Set welcome screen tracking to false localStorage.setItem("home:welcome:show", "false"); - cy.deleteAllIndices(); }); describe("can be created and updated", () => { beforeEach(() => { // Visit ISM OSD cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`); - cy.contains("Rows per page", { timeout: 60000 }); + cy.contains("Rows per page", { timeout: 20000 }); }); let splitNumber = 2; From 791727738eeae672975463d6cb9cdf30ac4ead23 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Sun, 13 Apr 2025 18:29:57 +0530 Subject: [PATCH 07/15] fixed indices Signed-off-by: Vaibhav Agarwal --- .github/actions/run-cypress-tests/action.yaml | 4 +- .../a_split_index.js | 42 +++++++++---------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/actions/run-cypress-tests/action.yaml b/.github/actions/run-cypress-tests/action.yaml index c33d13cdf..692fe942a 100644 --- a/.github/actions/run-cypress-tests/action.yaml +++ b/.github/actions/run-cypress-tests/action.yaml @@ -127,7 +127,7 @@ runs: if: ${{ inputs.with-security == 'false' }} with: working-directory: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin - command: yarn run cypress run --config-file cypress.config.js + command: yarn run cypress run wait-on: 'http://localhost:5601' browser: chrome - name: Cypress tests @@ -135,7 +135,7 @@ runs: if: ${{ inputs.with-security == 'true' }} with: working-directory: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin - command: yarn run cypress run --config-file cypress.config.js --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=500 + command: yarn run cypress run --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=500 wait-on: 'http://localhost:5601' browser: chrome # Screenshots are only captured on failure, will change this once we do visual regression tests diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index 60f56cd28..ad3ebbbcd 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -6,22 +6,35 @@ import { IM_PLUGIN_NAME, BASE_PATH } from "../../../utils/constants"; const sampleIndex = "index-split"; const sampleAlias = "alias-split"; +let splitNumber = 2; +let replicaNumber = 1; describe("Split Index", () => { before(() => { - // Set welcome screen tracking to false - localStorage.setItem("home:welcome:show", "false"); + cy.window().then((win) => { + win.localStorage.clear(); + win.sessionStorage.clear(); + win.localStorage.setItem("home:welcome:show", "false"); + }); }); describe("can be created and updated", () => { beforeEach(() => { - // Visit ISM OSD - cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`); - cy.contains("Rows per page", { timeout: 20000 }); + // Clear session data between tests + Cypress.session.clearCurrentSessionData(); + + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`, { + timeout: 30000, + onBeforeLoad: (win) => { + win.sessionStorage.clear(); + win.localStorage.clear(); + }, + }); + + // Wait for page load with proper assertion + cy.contains("Rows per page", { timeout: 20000 }).should("be.visible"); }); - let splitNumber = 2; - let replicaNumber = 1; it("Create an index successfully", () => { // enter create page cy.get('[data-test-subj="Create IndexButton"]').click(); @@ -37,21 +50,6 @@ describe("Split Index", () => { // The index should exist cy.get(`#_selection_column_${sampleIndex}-checkbox`).should("have.exist").end(); - - // cy.get(`[data-test-subj="viewIndexDetailButton-${sampleIndex}"]`, { timeout: 10000 }).click().end(); - // cy.get("#indexDetailModalSettings").click().end(); - // - // cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').then(($shardNumber) => { - // splitNumber = $shardNumber.attr("title") * 2; - // }); - // - // cy.get("#indexDetailModalAlias").click().end(); - // cy.get(`[title="${sampleAlias}"]`).should("exist").end(); - // - // // Update Index status to blocks write otherwise we can't apply split operation on it - // cy.updateIndexSettings(sampleIndex, { - // "index.blocks.write": "true", - // }).end(); }); // create index it("Split successfully", () => { From 0732c7381e99197d72e25bafc248a22050950e6c Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Mon, 14 Apr 2025 16:07:42 +0530 Subject: [PATCH 08/15] checking split_index.js Signed-off-by: Vaibhav Agarwal --- .../a_split_index.js | 160 ++---------------- 1 file changed, 12 insertions(+), 148 deletions(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index ad3ebbbcd..a80f2e403 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -39,153 +39,17 @@ describe("Split Index", () => { // enter create page cy.get('[data-test-subj="Create IndexButton"]').click(); cy.contains("Create index"); - - // type field name - cy.get('[placeholder="Specify a name for the new index."]').type(sampleIndex).end(); - - cy.get('[data-test-subj="comboBoxSearchInput"]').focus().type(`${sampleAlias}{enter}`).end(); - - // click create - cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true }).end(); - - // The index should exist - cy.get(`#_selection_column_${sampleIndex}-checkbox`).should("have.exist").end(); - }); // create index - - it("Split successfully", () => { - const targetIndex = `${sampleIndex}` + "-target"; - cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) - .click() - .end() - .get('[data-test-subj="moreAction"]') - .click() - .end() - .get('[data-test-subj="Split Action"]') - .click() - .end() - // Target Index Name is required - .get('[data-test-subj="targetIndexNameInput"]') - .type(`${targetIndex}`) - .end() - // Number of shards after split is required - .get('[data-test-subj="numberOfShardsInput"]') - .type(`${splitNumber}{downArrow}{enter}`) - .end() - .get('[data-test-subj="numberOfReplicasInput"]') - .clear() - .type(`${replicaNumber}`) - .end() - .get('[data-test-subj="splitButton"]', { timeout: 10000 }) - .click() - .end(); - - cy.wait(3000).reload(); - - cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`, { timeout: 12000 }).click().end(); - cy.get("#indexDetailModalSettings").click().end(); - cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); - cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); - }); // Split - - it("Split successfully with advanced setting", () => { - const targetIndex = `${sampleIndex}` + "-setting"; - cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) - .click() - .end() - .get('[data-test-subj="moreAction"]') - .click() - .end() - .get('[data-test-subj="Split Action"]') - .click() - .end() - .get("[data-test-subj=targetIndexNameInput]") - .type(`${targetIndex}`) - .end() - // Instead of input shard number at shard field, another option is to populate it in advanced setting - .get('[aria-controls="accordionForCreateIndexSettings"]') - .click() - .end() - .get('[data-test-subj="codeEditorContainer"] textarea') - .focus() - // Need to remove the default {} in advanced setting - .clear() - .type(`{"index.number_of_shards": "${splitNumber}", "index.number_of_replicas": "${replicaNumber}"}`, { - parseSpecialCharSequences: false, - }) - .end() - .get('[data-test-subj="splitButton"]', { timeout: 10000 }) - .click() - .end(); - - cy.wait(3000).reload(); - - cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`, { timeout: 10000 }).click().end(); - cy.get("#indexDetailModalSettings").click().end(); - cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); - cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); - }); // advanced setting - - it("Split successfully with alias", () => { - const targetIndex = `${sampleIndex}` + "-alias"; - const newAlias = "alias-new"; - cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) - .click() - .end() - .get('[data-test-subj="moreAction"]') - .click() - .end() - .get('[data-test-subj="Split Action"]') - .click() - .end() - .get("[data-test-subj=targetIndexNameInput]") - .type(`${targetIndex}`) - .end() - .get('[data-test-subj="numberOfShardsInput"]') - .type(`${splitNumber}{downArrow}{enter}`) - .end() - // Assign to an existing alias and a new alias - .get('[data-test-subj="form-name-aliases"] [data-test-subj="comboBoxSearchInput"]') - .type(`${sampleAlias}{enter}${newAlias}{enter}`) - .end() - .get('[data-test-subj="splitButton"]', { timeout: 10000 }) - .click() - .end(); - - cy.wait(3000).reload(); - - cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`, { timeout: 10000 }).click().end(); - // Verify alias associated with the new index - cy.get("#indexDetailModalAlias").click().end(); - cy.get(`[title="${newAlias}"]`).should("exist").end(); - cy.get(`[title="${sampleAlias}"]`).should("exist").end(); - }); // Create with alias - - it("Update blocks write to true", () => { - // Set index to not blocks write - cy.updateIndexSettings(sampleIndex, { - "index.blocks.write": "false", - }).end(); - cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) - .click() - .end() - .get('[data-test-subj="moreAction"]') - .click() - .end() - .get('[data-test-subj="Split Action"]') - .click() - .end() - // Index can't be split if it's blocks write status is not true - .get('[data-test-subj="splitButton"]', { timeout: 10000 }) - .should("have.class", "euiButton-isDisabled") - .end() - .wait(1000) - // Set index to blocks write - .get('[data-test-subj="set-indexsetting-button"]') - .click() - .end() - .get('[data-test-subj="splitButton"]', { timeout: 13000 }) - .click() - .end(); - }); // Blocks write + // + // // type field name + // cy.get('[placeholder="Specify a name for the new index."]').type(sampleIndex).end(); + // + // cy.get('[data-test-subj="comboBoxSearchInput"]').focus().type(`${sampleAlias}{enter}`).end(); + // + // // click create + // cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true }).end(); + // + // // The index should exist + // cy.get(`#_selection_column_${sampleIndex}-checkbox`).should("have.exist").end(); + }); }); }); From 53b777cd7cf1da028ceb92ec912b8994ecf63455 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Mon, 14 Apr 2025 17:08:58 +0530 Subject: [PATCH 09/15] debug split_index Signed-off-by: Vaibhav Agarwal --- .../a_split_index.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index a80f2e403..94ef67c44 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -39,17 +39,17 @@ describe("Split Index", () => { // enter create page cy.get('[data-test-subj="Create IndexButton"]').click(); cy.contains("Create index"); - // - // // type field name - // cy.get('[placeholder="Specify a name for the new index."]').type(sampleIndex).end(); - // - // cy.get('[data-test-subj="comboBoxSearchInput"]').focus().type(`${sampleAlias}{enter}`).end(); - // - // // click create - // cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true }).end(); - // - // // The index should exist - // cy.get(`#_selection_column_${sampleIndex}-checkbox`).should("have.exist").end(); + + // type field name + cy.get('[placeholder="Specify a name for the new index."]').type(sampleIndex).end(); + + cy.get('[data-test-subj="comboBoxSearchInput"]').focus().type(`${sampleAlias}{enter}`).end(); + + // click create + cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true }).end(); + + // The index should exist + cy.get(`#_selection_column_${sampleIndex}-checkbox`).should("have.exist").end(); }); }); }); From d1b75bae22aef82beae4913a56e33c377b93b6d8 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Mon, 14 Apr 2025 20:04:47 +0530 Subject: [PATCH 10/15] Debug2 split_index Signed-off-by: Vaibhav Agarwal --- .../index-management-dashboards-plugin/a_split_index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index 94ef67c44..363974c95 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -41,12 +41,14 @@ describe("Split Index", () => { cy.contains("Create index"); // type field name - cy.get('[placeholder="Specify a name for the new index."]').type(sampleIndex).end(); + cy.get('[placeholder="Specify a name for the new index."]').type(sampleIndex).blur(); + + cy.wait(1000); cy.get('[data-test-subj="comboBoxSearchInput"]').focus().type(`${sampleAlias}{enter}`).end(); // click create - cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true }).end(); + cy.get('[data-test-subj="createIndexCreateButton"]').click().end(); // The index should exist cy.get(`#_selection_column_${sampleIndex}-checkbox`).should("have.exist").end(); From e6600c287040342c38b8ed94971b04c31f446be8 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Mon, 14 Apr 2025 20:46:30 +0530 Subject: [PATCH 11/15] debug3 split_index Signed-off-by: Vaibhav Agarwal --- .../a_split_index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index 363974c95..decf83191 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -52,6 +52,21 @@ describe("Split Index", () => { // The index should exist cy.get(`#_selection_column_${sampleIndex}-checkbox`).should("have.exist").end(); + + cy.get(`[data-test-subj="viewIndexDetailButton-${sampleIndex}"]`).click().end(); + cy.get("#indexDetailModalSettings").click().end(); + + cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').then(($shardNumber) => { + splitNumber = $shardNumber.attr("title") * 2; + }); + + cy.get("#indexDetailModalAlias").click().end(); + cy.get(`[title="${sampleAlias}"]`).should("exist").end(); + + // Update Index status to blocks write otherwise we can't apply split operation on it + cy.updateIndexSettings(sampleIndex, { + "index.blocks.write": "true", + }).end(); }); }); }); From d7c57bc7cb201fe591f14de6db6b3d40264a8b01 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Mon, 14 Apr 2025 21:27:33 +0530 Subject: [PATCH 12/15] debug4 split_index Signed-off-by: Vaibhav Agarwal --- .../a_split_index.js | 132 +++++++++++++++++- 1 file changed, 131 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index decf83191..678056037 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -67,6 +67,136 @@ describe("Split Index", () => { cy.updateIndexSettings(sampleIndex, { "index.blocks.write": "true", }).end(); - }); + }); //create the index + + it("Split successfully", () => { + const targetIndex = `${sampleIndex}` + "-target"; + cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) + .click() + .end() + .get('[data-test-subj="moreAction"]') + .click() + .end() + .get('[data-test-subj="Split Action"]') + .click() + .end() + // Target Index Name is required + .get('[data-test-subj="targetIndexNameInput"]') + .type(`${targetIndex}`) + .end() + // Number of shards after split is required + .get('[data-test-subj="numberOfShardsInput"]') + .type(`${splitNumber}{downArrow}{enter}`) + .end() + .get('[data-test-subj="numberOfReplicasInput"]') + .clear() + .type(`${replicaNumber}`) + .end() + .get('[data-test-subj="splitButton"]') + .click() + .end(); + + cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end(); + cy.get("#indexDetailModalSettings").click().end(); + cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); + cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); + }); // Split + + it("Split successfully with advanced setting", () => { + const targetIndex = `${sampleIndex}` + "-setting"; + cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) + .click() + .end() + .get('[data-test-subj="moreAction"]') + .click() + .end() + .get('[data-test-subj="Split Action"]') + .click() + .end() + .get("[data-test-subj=targetIndexNameInput]") + .type(`${targetIndex}`) + .end() + // Instead of input shard number at shard field, another option is to populate it in advanced setting + .get('[aria-controls="accordionForCreateIndexSettings"]') + .click() + .end() + .get('[data-test-subj="codeEditorContainer"] textarea') + .focus() + // Need to remove the default {} in advanced setting + .clear() + .type(`{"index.number_of_shards": "${splitNumber}", "index.number_of_replicas": "${replicaNumber}"}`, { + parseSpecialCharSequences: false, + }) + .end() + .get('[data-test-subj="splitButton"]') + .click() + .end(); + + cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end(); + cy.get("#indexDetailModalSettings").click().end(); + cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); + cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); + }); // advanced setting + + it("Split successfully with alias", () => { + const targetIndex = `${sampleIndex}` + "-alias"; + const newAlias = "alias-new"; + cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) + .click() + .end() + .get('[data-test-subj="moreAction"]') + .click() + .end() + .get('[data-test-subj="Split Action"]') + .click() + .end() + .get("[data-test-subj=targetIndexNameInput]") + .type(`${targetIndex}`) + .end() + .get('[data-test-subj="numberOfShardsInput"]') + .type(`${splitNumber}{downArrow}{enter}`) + .end() + // Assign to an existing alias and a new alias + .get('[data-test-subj="form-name-aliases"] [data-test-subj="comboBoxSearchInput"]') + .type(`${sampleAlias}{enter}${newAlias}{enter}`) + .end() + .get('[data-test-subj="splitButton"]') + .click() + .end(); + + cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end(); + // Verify alias associated with the new index + cy.get("#indexDetailModalAlias").click().end(); + cy.get(`[title="${newAlias}"]`).should("exist").end(); + cy.get(`[title="${sampleAlias}"]`).should("exist").end(); + }); // Create with alias + + it("Update blocks write to true", () => { + // Set index to not blocks write + cy.updateIndexSettings(sampleIndex, { + "index.blocks.write": "false", + }).end(); + cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) + .click() + .end() + .get('[data-test-subj="moreAction"]') + .click() + .end() + .get('[data-test-subj="Split Action"]') + .click() + .end() + // Index can't be split if it's blocks write status is not true + .get('[data-test-subj="splitButton"]') + .should("have.class", "euiButton-isDisabled") + .end() + .wait(1000) + // Set index to blocks write + .get('[data-test-subj="set-indexsetting-button"]') + .click() + .end() + .get('[data-test-subj="splitButton"]') + .click() + .end(); + }); // Blocks write }); }); From 86794d3e6f9ae9826aa82a153570221e41e1cb31 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Mon, 14 Apr 2025 22:20:22 +0530 Subject: [PATCH 13/15] debug5 split_index Signed-off-by: Vaibhav Agarwal --- .../a_split_index.js | 121 ++++-------------- 1 file changed, 28 insertions(+), 93 deletions(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index 678056037..d07ca2502 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -104,99 +104,34 @@ describe("Split Index", () => { it("Split successfully with advanced setting", () => { const targetIndex = `${sampleIndex}` + "-setting"; - cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) - .click() - .end() - .get('[data-test-subj="moreAction"]') - .click() - .end() - .get('[data-test-subj="Split Action"]') - .click() - .end() - .get("[data-test-subj=targetIndexNameInput]") - .type(`${targetIndex}`) - .end() - // Instead of input shard number at shard field, another option is to populate it in advanced setting - .get('[aria-controls="accordionForCreateIndexSettings"]') - .click() - .end() - .get('[data-test-subj="codeEditorContainer"] textarea') - .focus() - // Need to remove the default {} in advanced setting - .clear() - .type(`{"index.number_of_shards": "${splitNumber}", "index.number_of_replicas": "${replicaNumber}"}`, { - parseSpecialCharSequences: false, - }) - .end() - .get('[data-test-subj="splitButton"]') - .click() - .end(); - - cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end(); - cy.get("#indexDetailModalSettings").click().end(); - cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); - cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); + cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`).click().end(); + cy.wait(1000); + cy.get('[data-test-subj="moreAction"]').click().end(); + cy.get('[data-test-subj="Split Action"]').click().end(); + cy.wait(1000); + // cy.get("[data-test-subj=targetIndexNameInput]") + // .type(`${targetIndex}`) + // .end() + // // Instead of input shard number at shard field, another option is to populate it in advanced setting + // .get('[aria-controls="accordionForCreateIndexSettings"]') + // .click() + // .end() + // .get('[data-test-subj="codeEditorContainer"] textarea') + // .focus() + // // Need to remove the default {} in advanced setting + // .clear() + // .type(`{"index.number_of_shards": "${splitNumber}", "index.number_of_replicas": "${replicaNumber}"}`, { + // parseSpecialCharSequences: false, + // }) + // .end() + // .get('[data-test-subj="splitButton"]') + // .click() + // .end(); + // + // cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end(); + // cy.get("#indexDetailModalSettings").click().end(); + // cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); + // cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); }); // advanced setting - - it("Split successfully with alias", () => { - const targetIndex = `${sampleIndex}` + "-alias"; - const newAlias = "alias-new"; - cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) - .click() - .end() - .get('[data-test-subj="moreAction"]') - .click() - .end() - .get('[data-test-subj="Split Action"]') - .click() - .end() - .get("[data-test-subj=targetIndexNameInput]") - .type(`${targetIndex}`) - .end() - .get('[data-test-subj="numberOfShardsInput"]') - .type(`${splitNumber}{downArrow}{enter}`) - .end() - // Assign to an existing alias and a new alias - .get('[data-test-subj="form-name-aliases"] [data-test-subj="comboBoxSearchInput"]') - .type(`${sampleAlias}{enter}${newAlias}{enter}`) - .end() - .get('[data-test-subj="splitButton"]') - .click() - .end(); - - cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end(); - // Verify alias associated with the new index - cy.get("#indexDetailModalAlias").click().end(); - cy.get(`[title="${newAlias}"]`).should("exist").end(); - cy.get(`[title="${sampleAlias}"]`).should("exist").end(); - }); // Create with alias - - it("Update blocks write to true", () => { - // Set index to not blocks write - cy.updateIndexSettings(sampleIndex, { - "index.blocks.write": "false", - }).end(); - cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) - .click() - .end() - .get('[data-test-subj="moreAction"]') - .click() - .end() - .get('[data-test-subj="Split Action"]') - .click() - .end() - // Index can't be split if it's blocks write status is not true - .get('[data-test-subj="splitButton"]') - .should("have.class", "euiButton-isDisabled") - .end() - .wait(1000) - // Set index to blocks write - .get('[data-test-subj="set-indexsetting-button"]') - .click() - .end() - .get('[data-test-subj="splitButton"]') - .click() - .end(); - }); // Blocks write }); }); From c2b27a8f169089ca3d8d87b3fa0a7f9a3e5f7de4 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Tue, 15 Apr 2025 14:05:44 +0530 Subject: [PATCH 14/15] debug6 Signed-off-by: Vaibhav Agarwal --- .../a_split_index.js | 59 ++++--------------- 1 file changed, 11 insertions(+), 48 deletions(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index d07ca2502..7d0d3f4e1 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -71,58 +71,21 @@ describe("Split Index", () => { it("Split successfully", () => { const targetIndex = `${sampleIndex}` + "-target"; - cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) - .click() - .end() - .get('[data-test-subj="moreAction"]') - .click() - .end() - .get('[data-test-subj="Split Action"]') - .click() - .end() - // Target Index Name is required - .get('[data-test-subj="targetIndexNameInput"]') - .type(`${targetIndex}`) - .end() - // Number of shards after split is required - .get('[data-test-subj="numberOfShardsInput"]') - .type(`${splitNumber}{downArrow}{enter}`) - .end() - .get('[data-test-subj="numberOfReplicasInput"]') - .clear() - .type(`${replicaNumber}`) - .end() - .get('[data-test-subj="splitButton"]') - .click() - .end(); - - cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end(); - cy.get("#indexDetailModalSettings").click().end(); - cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); - cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); - }); // Split - - it("Split successfully with advanced setting", () => { - const targetIndex = `${sampleIndex}` + "-setting"; cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`).click().end(); - cy.wait(1000); - cy.get('[data-test-subj="moreAction"]').click().end(); - cy.get('[data-test-subj="Split Action"]').click().end(); - cy.wait(1000); - // cy.get("[data-test-subj=targetIndexNameInput]") + + cy.wait(3000); + cy.get('[data-test-subj="moreAction"]').click().end().get('[data-test-subj="Split Action"]').click().end(); + // // Target Index Name is required + // .get('[data-test-subj="targetIndexNameInput"]') // .type(`${targetIndex}`) // .end() - // // Instead of input shard number at shard field, another option is to populate it in advanced setting - // .get('[aria-controls="accordionForCreateIndexSettings"]') - // .click() + // // Number of shards after split is required + // .get('[data-test-subj="numberOfShardsInput"]') + // .type(`${splitNumber}{downArrow}{enter}`) // .end() - // .get('[data-test-subj="codeEditorContainer"] textarea') - // .focus() - // // Need to remove the default {} in advanced setting + // .get('[data-test-subj="numberOfReplicasInput"]') // .clear() - // .type(`{"index.number_of_shards": "${splitNumber}", "index.number_of_replicas": "${replicaNumber}"}`, { - // parseSpecialCharSequences: false, - // }) + // .type(`${replicaNumber}`) // .end() // .get('[data-test-subj="splitButton"]') // .click() @@ -132,6 +95,6 @@ describe("Split Index", () => { // cy.get("#indexDetailModalSettings").click().end(); // cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); // cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); - }); // advanced setting + }); // Split }); }); From d1d85aaf1195f1ef9eec1f44d4970794d5bcfe81 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Tue, 15 Apr 2025 18:11:28 +0530 Subject: [PATCH 15/15] debug7 Signed-off-by: Vaibhav Agarwal --- .../a_split_index.js | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js index 7d0d3f4e1..8f64fe80e 100644 --- a/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js +++ b/cypress/e2e/plugins/index-management-dashboards-plugin/a_split_index.js @@ -75,26 +75,19 @@ describe("Split Index", () => { cy.wait(3000); cy.get('[data-test-subj="moreAction"]').click().end().get('[data-test-subj="Split Action"]').click().end(); - // // Target Index Name is required - // .get('[data-test-subj="targetIndexNameInput"]') - // .type(`${targetIndex}`) - // .end() - // // Number of shards after split is required - // .get('[data-test-subj="numberOfShardsInput"]') - // .type(`${splitNumber}{downArrow}{enter}`) - // .end() - // .get('[data-test-subj="numberOfReplicasInput"]') - // .clear() - // .type(`${replicaNumber}`) - // .end() - // .get('[data-test-subj="splitButton"]') - // .click() - // .end(); - // - // cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end(); - // cy.get("#indexDetailModalSettings").click().end(); - // cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); - // cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); + // Target Index Name is required + cy.get('[data-test-subj="targetIndexNameInput"]').type(`${targetIndex}`).end(); + // Number of shards after split is required + cy.get('[data-test-subj="numberOfShardsInput"]').type(`${splitNumber}{downArrow}{enter}`).end(); + cy.get('[data-test-subj="numberOfReplicasInput"]').clear().type(`${replicaNumber}`).end(); + cy.get('[data-test-subj="splitButton"]').click().end(); + + cy.wait(3000); + + cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end(); + cy.get("#indexDetailModalSettings").click().end(); + cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end(); + cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end(); }); // Split }); });