diff --git a/cypress.json b/cypress.json index ef5dce071..1ccf74bb5 100644 --- a/cypress.json +++ b/cypress.json @@ -1,13 +1,14 @@ { - "viewportHeight": 900, - "viewportWidth": 1440, - "defaultCommandTimeout": 10000, - "nodeVersion": "system", + "defaultCommandTimeout": 60000, + "requestTimeout": 60000, + "responseTimeout": 60000, + "baseUrl": "http://localhost:5601", + "viewportWidth": 2000, + "viewportHeight": 1320, "env": { - "opensearch_url": "localhost:9200", - "opensearch_dashboards": "http://localhost:5601", - "security_enabled": false, + "openSearchUrl": "http://localhost:9200", + "SECURITY_ENABLED": false, "username": "admin", "password": "admin" } -} \ No newline at end of file +} diff --git a/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_data_stream_policy.json b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_data_stream_policy.json new file mode 100644 index 000000000..8d6c5c7d9 --- /dev/null +++ b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_data_stream_policy.json @@ -0,0 +1,40 @@ +{ + "policy": { + "description": "A simple description", + "default_state": "hot", + "states": [ + { + "name": "hot", + "actions": [ + { + "replica_count": { + "number_of_replicas": 5 + } + } + ], + "transitions": [ + { + "state_name": "cold", + "conditions": { + "min_index_age": "30d" + } + } + ] + }, + { + "name": "cold", + "actions": [ + { + "replica_count": { + "number_of_replicas": 2 + } + } + ], + "transitions": [] + } + ], + "ism_template": { + "index_patterns": ["logs-*"] + } + } +} diff --git a/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_policy.json b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_policy.json new file mode 100644 index 000000000..64d558bb0 --- /dev/null +++ b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_policy.json @@ -0,0 +1,37 @@ +{ + "policy": { + "description": "A simple description", + "default_state": "hot", + "states": [ + { + "name": "hot", + "actions": [ + { + "replica_count": { + "number_of_replicas": 5 + } + } + ], + "transitions": [ + { + "state_name": "cold", + "conditions": { + "min_index_age": "30d" + } + } + ] + }, + { + "name": "cold", + "actions": [ + { + "replica_count": { + "number_of_replicas": 2 + } + } + ], + "transitions": [] + } + ] + } +} diff --git a/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_rollover_policy.json b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_rollover_policy.json new file mode 100644 index 000000000..1bd9e99a8 --- /dev/null +++ b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_rollover_policy.json @@ -0,0 +1,38 @@ +{ + "policy": { + "description": "A simple description", + "default_state": "hot", + "states": [ + { + "name": "hot", + "actions": [ + { + "rollover": {}, + "retry": { + "count": 0 + } + } + ], + "transitions": [ + { + "state_name": "cold", + "conditions": { + "min_index_age": "30d" + } + } + ] + }, + { + "name": "cold", + "actions": [ + { + "replica_count": { + "number_of_replicas": 2 + } + } + ], + "transitions": [] + } + ] + } +} diff --git a/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_rollup.json b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_rollup.json new file mode 100644 index 000000000..47d263895 --- /dev/null +++ b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_rollup.json @@ -0,0 +1,58 @@ +{ + "rollup": { + "enabled": true, + "schedule": { + "interval": { + "period": 1, + "unit": "Minutes", + "start_time": 1602100553 + } + }, + "last_updated_time": 1602100553, + "description": "An example rollup job that rolls up the sample ecommerce data", + "source_index": "opensearch_dashboards_sample_data_ecommerce", + "target_index": "test_rollup_target", + "page_size": 1000, + "delay": 0, + "continuous": false, + "dimensions": [ + { + "date_histogram": { + "source_field": "order_date", + "fixed_interval": "90m", + "timezone": "America/Los_Angeles" + } + }, + { + "terms": { + "source_field": "customer_gender" + } + }, + { + "terms": { + "source_field": "geoip.city_name" + } + }, + { + "terms": { + "source_field": "geoip.region_name" + } + }, + { + "terms": { + "source_field": "day_of_week" + } + } + ], + "metrics": [ + { + "source_field": "taxless_total_price", + "metrics": [{ "avg": {} }, { "sum": {} }, { "max": {} }, { "min": {} }, { "value_count": {} }] + }, + { + "source_field": "total_quantity", + "metrics": [{ "avg": {} }, { "max": {} }] + } + ] + } +} diff --git a/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_transform.json b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_transform.json new file mode 100644 index 000000000..85d929468 --- /dev/null +++ b/cypress/fixtures/plugins/index-management-dashboards-plugin/sample_transform.json @@ -0,0 +1,40 @@ +{ + "transform": { + "enabled": true, + "schedule": { + "interval": { + "period": 1, + "unit": "Minutes", + "start_time": 1602100553 + } + }, + "description": "Test transform", + "source_index": "opensearch_dashboards_sample_data_ecommerce", + "target_index": "test_transform", + "data_selection_query": { + "match_all": {} + }, + "page_size": 1000, + "groups": [ + { + "terms": { + "source_field": "customer_gender", + "target_field": "gender" + } + }, + { + "terms": { + "source_field": "day_of_week", + "target_field": "day" + } + } + ], + "aggregations": { + "quantity": { + "sum": { + "field": "total_quantity" + } + } + } + } +} diff --git a/cypress/integration/aliases.js b/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js similarity index 76% rename from cypress/integration/aliases.js rename to cypress/integration/plugins/index-management-dashboards-plugin/aliases.js index f4330cf3c..0978cdcca 100644 --- a/cypress/integration/aliases.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js @@ -2,7 +2,7 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; +import { IM_PLUGIN_NAME, BASE_PATH } from "../../../utils/constants"; const SAMPLE_INDEX_PREFIX = "index-for-alias-test"; const SAMPLE_ALIAS_PREFIX = "alias-for-test"; @@ -19,15 +19,15 @@ describe("Aliases", () => { } cy.createIndex(EDIT_INDEX, null); for (let i = 0; i < 30; i++) { - cy.addAlias(`${SAMPLE_ALIAS_PREFIX}-${i}`, `${SAMPLE_INDEX_PREFIX}-${i % 11}`); + cy.addIndexAlias(`${SAMPLE_ALIAS_PREFIX}-${i}`, `${SAMPLE_INDEX_PREFIX}-${i % 11}`); } - cy.removeAlias(`${SAMPLE_ALIAS_PREFIX}-0`); - cy.addAlias(`${SAMPLE_ALIAS_PREFIX}-0`, `${SAMPLE_INDEX_PREFIX}-*`); + cy.removeIndexAlias(`${SAMPLE_ALIAS_PREFIX}-0`); + cy.addIndexAlias(`${SAMPLE_ALIAS_PREFIX}-0`, `${SAMPLE_INDEX_PREFIX}-*`); }); beforeEach(() => { // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/aliases`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/aliases`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Rows per page", { timeout: 60000 }); @@ -94,26 +94,14 @@ describe("Aliases", () => { .end(); cy.get('[data-test-subj="7 more"]').should("exist"); - - cy.get('[data-test-subj="moreAction"] button').click().get('[data-test-subj="deleteAction"]').click(); - // The confirm button should be disabled - cy.get('[data-test-subj="deleteConfirmButton"]').should("be.disabled"); - // type delete - cy.wait(500).get('[data-test-subj="deleteInput"]').type("delete"); - cy.get('[data-test-subj="deleteConfirmButton"]').should("not.be.disabled"); - // click to delete - cy.get('[data-test-subj="deleteConfirmButton"]').click(); - // the alias should not exist - cy.wait(500); - cy.get(`#_selection_column_${SAMPLE_ALIAS_PREFIX}-0-checkbox`).should("not.exist"); }); }); after(() => { cy.deleteAllIndices(); for (let i = 0; i < 30; i++) { - cy.removeAlias(`${SAMPLE_ALIAS_PREFIX}-${i}`); + cy.removeIndexAlias(`${SAMPLE_ALIAS_PREFIX}-${i}`); } - cy.removeAlias(CREATE_ALIAS); + cy.removeIndexAlias(CREATE_ALIAS); }); }); diff --git a/cypress/integration/create_index.js b/cypress/integration/plugins/index-management-dashboards-plugin/create_index.js similarity index 93% rename from cypress/integration/create_index.js rename to cypress/integration/plugins/index-management-dashboards-plugin/create_index.js index 1b6709568..1b0c5a5e2 100644 --- a/cypress/integration/create_index.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/create_index.js @@ -2,7 +2,7 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; +import { IM_PLUGIN_NAME, BASE_PATH } from "../../../utils/constants"; const SAMPLE_INDEX = "index-specific-index"; @@ -51,7 +51,7 @@ describe("Create Index", () => { describe("can be created and updated", () => { beforeEach(() => { // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/indices`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`); cy.contains("Rows per page", { timeout: 60000 }); }); @@ -106,13 +106,15 @@ describe("Create Index", () => { cy.get('[data-test-subj="mapping-visual-editor-1-field-name"]').type("text_mappings"); // click create - cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true }); + cy.get('[data-test-subj="createIndexCreateButton"]').click({ + force: true, + }); // The index should exist cy.get(`#_selection_column_${SAMPLE_INDEX}-checkbox`).should("have.exist"); // check the index detail - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/create-index/${SAMPLE_INDEX}`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/create-index/${SAMPLE_INDEX}`); // index name and alias should exist cy.get(`[title="${SAMPLE_INDEX}"]`) @@ -171,14 +173,19 @@ describe("Create Index", () => { }) .blur(); - cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true }); + cy.get('[data-test-subj="createIndexCreateButton"]').click({ + force: true, + }); cy.contains(`Can't update non dynamic settings`).should("exist"); cy.get(".ace_text-input") .focus() .clear({ force: true }) - .type('{ "index.blocks.write": true, "index.number_of_shards": "3" }', { parseSpecialCharSequences: false, force: true }) + .type('{ "index.blocks.write": true, "index.number_of_shards": "3" }', { + parseSpecialCharSequences: false, + force: true, + }) .end() .wait(1000) .get('[placeholder="Specify number of replicas."]') @@ -186,7 +193,9 @@ describe("Create Index", () => { .type(2) .end(); - cy.get('[data-test-subj="createIndexCreateButton"]').click({ force: true }); + cy.get('[data-test-subj="createIndexCreateButton"]').click({ + force: true, + }); cy.wait(1000).get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", "2"); }); @@ -211,7 +220,10 @@ describe("Create Index", () => { .get(".ace_text-input") .focus() .clear({ force: true }) - .type('{ "dynamic": true }', { parseSpecialCharSequences: false, force: true }) + .type('{ "dynamic": true }', { + parseSpecialCharSequences: false, + force: true, + }) .blur() .end() .wait(1000) diff --git a/cypress/integration/data_streams.js b/cypress/integration/plugins/index-management-dashboards-plugin/data_streams.js similarity index 91% rename from cypress/integration/data_streams.js rename to cypress/integration/plugins/index-management-dashboards-plugin/data_streams.js index 193112db5..3d95714a0 100644 --- a/cypress/integration/data_streams.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/data_streams.js @@ -2,7 +2,7 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; +import { IM_PLUGIN_NAME, BASE_PATH, BACKEND_BASE_PATH } from "../../../utils/constants"; describe("Data stream", () => { before(() => { @@ -24,7 +24,7 @@ describe("Data stream", () => { }, }); cy.request({ - url: `${Cypress.env("opensearch")}/_data_stream/*`, + url: `${BACKEND_BASE_PATH}/_data_stream/*`, method: "DELETE", failOnStatusCode: false, }); @@ -32,7 +32,7 @@ describe("Data stream", () => { beforeEach(() => { // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/data-streams`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/data-streams`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Data streams", { timeout: 60000 }); @@ -82,7 +82,7 @@ describe("Data stream", () => { after(() => { cy.request({ - url: `${Cypress.env("opensearch")}/_data_stream`, + url: `${BACKEND_BASE_PATH}/_data_stream`, method: "DELETE", failOnStatusCode: false, }); diff --git a/cypress/integration/force_merge.js b/cypress/integration/plugins/index-management-dashboards-plugin/force_merge.js similarity index 82% rename from cypress/integration/force_merge.js rename to cypress/integration/plugins/index-management-dashboards-plugin/force_merge.js index d60f29360..0eff991af 100644 --- a/cypress/integration/force_merge.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/force_merge.js @@ -2,7 +2,7 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; +import { IM_PLUGIN_NAME, BASE_PATH, BACKEND_BASE_PATH } from "../../../utils/constants"; const rolloverValidAlias = "rollover-valid-alias"; const rolloverAliasNeedTargetIndex = "rollover-alias-need-target-index"; @@ -17,14 +17,14 @@ describe("force_merge", () => { cy.deleteTemplate("index-common-template"); cy.deleteAllIndices(); cy.request({ - url: `${Cypress.env("opensearch")}/_data_stream/*`, + url: `${BACKEND_BASE_PATH}/_data_stream/*`, method: "DELETE", failOnStatusCode: false, }); cy.createIndex(validIndex); cy.createIndex(invalidIndex); - cy.addAlias(rolloverValidAlias, validIndex); - cy.addAlias(rolloverAliasNeedTargetIndex, invalidIndex); + cy.addIndexAlias(rolloverValidAlias, validIndex); + cy.addIndexAlias(rolloverAliasNeedTargetIndex, invalidIndex); cy.createIndexTemplate("index-common-template", { index_patterns: ["data-stream-*"], data_stream: {}, @@ -40,7 +40,7 @@ describe("force_merge", () => { }, }); cy.request({ - url: `${Cypress.env("opensearch")}/_data_stream/${rolloverDataStream}`, + url: `${BACKEND_BASE_PATH}/_data_stream/${rolloverDataStream}`, method: "PUT", failOnStatusCode: false, }); @@ -49,7 +49,7 @@ describe("force_merge", () => { describe("force merge", () => { it("force merge data stream / index / alias successfully", () => { // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/force-merge`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/force-merge`); cy.contains("Configure source index", { timeout: 60000 }); // click create @@ -70,7 +70,7 @@ describe("force_merge", () => { cy.deleteTemplate("index-common-template"); cy.deleteAllIndices(); cy.request({ - url: `${Cypress.env("opensearch")}/_data_stream/*`, + url: `${BACKEND_BASE_PATH}/_data_stream/*`, method: "DELETE", failOnStatusCode: false, }); diff --git a/cypress/integration/indices_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js similarity index 89% rename from cypress/integration/indices_spec.js rename to cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js index 28c66eee7..77e2443a1 100644 --- a/cypress/integration/indices_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; -import samplePolicy from "../fixtures/sample_policy"; +import { BASE_PATH, IM_PLUGIN_NAME, BACKEND_BASE_PATH } from "../../../utils/constants"; +import samplePolicy from "../../../fixtures/plugins/index-management-dashboards-plugin/sample_policy"; const POLICY_ID = "test_policy_id"; const SAMPLE_INDEX = "sample_index"; @@ -15,7 +15,7 @@ describe("Indices", () => { localStorage.setItem("home:welcome:show", "false"); // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/indices`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Rows per page", { timeout: 60000 }); @@ -24,6 +24,8 @@ describe("Indices", () => { describe("can be searched", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); + cy.deleteIMJobs(); // Create 20+ indices that can be sorted alphabetically by using letters a-z for (let i = 97; i < 123; i++) { const char = String.fromCharCode(i); @@ -53,6 +55,7 @@ describe("Indices", () => { describe("can show data stream indices", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.deleteDataStreams("*"); cy.createIndexTemplate("logs-template", { @@ -72,6 +75,9 @@ describe("Indices", () => { }); it("successfully", () => { + cy.get('[data-test-subj="tablePaginationPopoverButton"]').click(); + cy.get(".euiContextMenuItem__text").contains("50 rows").click(); + // Confirm that the regular indices are shown. cy.contains("index-1"); cy.contains("index-2"); @@ -117,6 +123,7 @@ describe("Indices", () => { describe("can have policies applied", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createPolicy(POLICY_ID, samplePolicy); cy.createIndex(SAMPLE_INDEX); }); @@ -129,7 +136,9 @@ describe("Indices", () => { cy.get(`tbody > tr:contains("${SAMPLE_INDEX}") > td`).filter(`:nth-child(4)`).contains("No"); // Select checkbox for our index - cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ force: true }); + cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ + force: true, + }); // Click apply policy button cy.get('[data-test-subj="moreAction"]').click(); @@ -142,7 +151,9 @@ describe("Indices", () => { cy.contains("A simple description"); - cy.get(`[data-test-subj="applyPolicyModalEditButton"]`).click({ force: true }); + cy.get(`[data-test-subj="applyPolicyModalEditButton"]`).click({ + force: true, + }); // Wait some time for apply policy to execute before reload cy.wait(3000).reload(); @@ -161,6 +172,7 @@ describe("Indices", () => { describe("can make indices deleted", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createIndex(SAMPLE_INDEX); }); @@ -184,6 +196,7 @@ describe("Indices", () => { cy.get('[data-test-subj="deleteAction"]').should("exist").should("not.have.class", "euiContextMenuItem-isDisabled").click(); // The confirm button should be disabled cy.get('[data-test-subj="Delete Confirm button"]').should("have.class", "euiButton-isDisabled"); + cy.wait(1000); // type delete cy.get('[placeholder="delete"]').type("delete"); cy.get('[data-test-subj="Delete Confirm button"]').should("not.have.class", "euiContextMenuItem-isDisabled"); @@ -198,6 +211,7 @@ describe("Indices", () => { describe("shows detail of a index when click the item", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createIndex(SAMPLE_INDEX); }); @@ -215,15 +229,16 @@ describe("Indices", () => { const splittedIndex = "split_opensearch_dashboards_sample_data_logs"; before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/indices`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Rows per page", { timeout: 60000 }); cy.request({ method: "POST", - url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/ecommerce`, + url: `${BASE_PATH}/api/sample_data/ecommerce`, headers: { "osd-xsrf": true, }, @@ -233,7 +248,7 @@ describe("Indices", () => { cy.request({ method: "POST", - url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/logs`, + url: `${BASE_PATH}/api/sample_data/logs`, headers: { "osd-xsrf": true, }, @@ -243,7 +258,7 @@ describe("Indices", () => { cy.request({ method: "PUT", - url: `${Cypress.env("opensearch")}/${splittedIndex}/_settings`, + url: `${BACKEND_BASE_PATH}/${splittedIndex}/_settings`, body: { "index.blocks.read_only": false, }, @@ -251,12 +266,12 @@ describe("Indices", () => { }); cy.request({ method: "DELETE", - url: `${Cypress.env("opensearch")}/${reindexedIndex}`, + url: `${BACKEND_BASE_PATH}/${reindexedIndex}`, failOnStatusCode: false, }); cy.request({ method: "DELETE", - url: `${Cypress.env("opensearch")}/${splittedIndex}`, + url: `${BACKEND_BASE_PATH}/${splittedIndex}`, failOnStatusCode: false, }); }); @@ -264,7 +279,7 @@ describe("Indices", () => { it("Successfully", () => { cy.request({ method: "PUT", - url: `${Cypress.env("opensearch")}/${reindexedIndex}`, + url: `${BACKEND_BASE_PATH}/${reindexedIndex}`, body: { settings: { index: { @@ -275,7 +290,7 @@ describe("Indices", () => { }, }); // do a simple reindex - cy.request("POST", `${Cypress.env("opensearch")}/_reindex?wait_for_completion=false`, { + cy.request("POST", `${BACKEND_BASE_PATH}/_reindex?wait_for_completion=false`, { source: { index: "opensearch_dashboards_sample_data_ecommerce", }, @@ -287,13 +302,13 @@ describe("Indices", () => { cy.get('[placeholder="Search"]').type("o"); // do a simple split - cy.request("PUT", `${Cypress.env("opensearch")}/opensearch_dashboards_sample_data_logs/_settings`, { + cy.request("PUT", `${BACKEND_BASE_PATH}/opensearch_dashboards_sample_data_logs/_settings`, { "index.blocks.write": true, }); cy.request({ method: "POST", - url: `${Cypress.env("opensearch_dashboards")}/api/ism/apiCaller`, + url: `${BASE_PATH}/api/ism/apiCaller`, headers: { "osd-xsrf": true, }, @@ -319,12 +334,12 @@ describe("Indices", () => { after(() => { cy.request({ method: "DELETE", - url: `${Cypress.env("opensearch")}/${reindexedIndex}`, + url: `${BACKEND_BASE_PATH}/${reindexedIndex}`, failOnStatusCode: false, }); cy.request({ method: "DELETE", - url: `${Cypress.env("opensearch")}/${splittedIndex}`, + url: `${BACKEND_BASE_PATH}/${splittedIndex}`, failOnStatusCode: false, }); }); @@ -333,8 +348,13 @@ describe("Indices", () => { describe("can shrink an index", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createIndex(SAMPLE_INDEX, null, { - settings: { "index.blocks.write": true, "index.number_of_shards": 2, "index.number_of_replicas": 0 }, + settings: { + "index.blocks.write": true, + "index.number_of_shards": 2, + "index.number_of_replicas": 0, + }, }); }); @@ -351,7 +371,9 @@ describe("Indices", () => { cy.get('[data-test-subj="Shrink Action"]').should("have.class", "euiContextMenuItem-isDisabled"); // Select an index - cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ force: true }); + cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ + force: true, + }); cy.get('[data-test-subj="moreAction"]').click(); // Shrink btn should be enabled @@ -374,6 +396,7 @@ describe("Indices", () => { describe("can close and open an index", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createIndex(SAMPLE_INDEX); }); @@ -385,7 +408,9 @@ describe("Indices", () => { cy.get('[data-test-subj="Close Action"]').should("have.class", "euiContextMenuItem-isDisabled"); // Select an index - cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ force: true }); + cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ + force: true, + }); cy.get('[data-test-subj="moreAction"]').click(); // Close btn should be enabled @@ -423,7 +448,9 @@ describe("Indices", () => { cy.get('[data-test-subj="Open Action"]').should("have.class", "euiContextMenuItem-isDisabled"); // Select an index - cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ force: true }); + cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ + force: true, + }); cy.get('[data-test-subj="moreAction"]').click(); // Open btn should be enabled diff --git a/cypress/integration/managed_indices_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/managed_indices_spec.js similarity index 89% rename from cypress/integration/managed_indices_spec.js rename to cypress/integration/plugins/index-management-dashboards-plugin/managed_indices_spec.js index 9dfec8036..40e1a49cb 100644 --- a/cypress/integration/managed_indices_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/managed_indices_spec.js @@ -3,10 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; -import samplePolicy from "../fixtures/sample_policy"; -import sampleRolloverPolicy from "../fixtures/sample_rollover_policy"; -import sampleDataStreamPolicy from "../fixtures/sample_data_stream_policy.json"; +import { BASE_PATH, IM_PLUGIN_NAME } from "../../../utils/constants"; +import samplePolicy from "../../../fixtures/plugins/index-management-dashboards-plugin/sample_policy"; +import sampleRolloverPolicy from "../../../fixtures/plugins/index-management-dashboards-plugin/sample_rollover_policy"; +import sampleDataStreamPolicy from "../../../fixtures/plugins/index-management-dashboards-plugin/sample_data_stream_policy.json"; const POLICY_ID = "test_policy_id"; const POLICY_ID_2 = "test_policy_id_2"; @@ -24,7 +24,7 @@ describe("Managed indices", () => { cy.wait(3000); // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/managed-indices`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/managed-indices`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Edit rollover alias", { timeout: 60000 }); @@ -35,6 +35,7 @@ describe("Managed indices", () => { describe("can have policies removed", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createPolicy(POLICY_ID, samplePolicy); cy.createIndex(SAMPLE_INDEX, POLICY_ID); }); @@ -44,13 +45,17 @@ describe("Managed indices", () => { cy.contains(POLICY_ID); // Select checkbox for our managed index - cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ force: true }); + cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ + force: true, + }); // Click Remove policy button cy.get(`[data-test-subj="Remove policyButton"]`).click({ force: true }); // Click confirmation modal button - cy.get(`[data-test-subj="confirmationModalActionButton"]`).click({ force: true }); + cy.get(`[data-test-subj="confirmationModalActionButton"]`).click({ + force: true, + }); // Confirm we got a remove policy toaster cy.contains("Removed policy from 1 managed indices"); @@ -66,10 +71,13 @@ describe("Managed indices", () => { describe("can have policies retried", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); // Create a policy that rolls over cy.createPolicy(POLICY_ID_ROLLOVER, sampleRolloverPolicy); // Create index with alias to rollover - cy.createIndex(SAMPLE_INDEX_ROLLOVER, POLICY_ID_ROLLOVER, { aliases: { "retry-rollover-alias": {} } }); + cy.createIndex(SAMPLE_INDEX_ROLLOVER, POLICY_ID_ROLLOVER, { + aliases: { "retry-rollover-alias": {} }, + }); }); it("successfully", () => { @@ -99,7 +107,9 @@ describe("Managed indices", () => { cy.contains("Missing rollover_alias"); // Add rollover alias - cy.updateIndexSettings(SAMPLE_INDEX_ROLLOVER, { "plugins.index_state_management.rollover_alias": "retry-rollover-alias" }); + cy.updateIndexSettings(SAMPLE_INDEX_ROLLOVER, { + "plugins.index_state_management.rollover_alias": "retry-rollover-alias", + }); // Select checkbox for our managed index cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX_ROLLOVER}"]`).check({ force: true }); @@ -139,10 +149,13 @@ describe("Managed indices", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createPolicy(POLICY_ID, samplePolicy); // Create index with rollover_alias cy.createIndex(SAMPLE_INDEX, POLICY_ID, { - settings: { plugins: { index_state_management: { rollover_alias: FIRST_ALIAS } } }, + settings: { + plugins: { index_state_management: { rollover_alias: FIRST_ALIAS } }, + }, }); }); @@ -157,16 +170,22 @@ describe("Managed indices", () => { }); // Select checkbox for our managed index - cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ force: true }); + cy.get(`[data-test-subj="checkboxSelectRow-${SAMPLE_INDEX}"]`).check({ + force: true, + }); // Click edit rollover alias button - cy.get(`[data-test-subj="Edit rollover aliasButton"]`).click({ force: true }); + cy.get(`[data-test-subj="Edit rollover aliasButton"]`).click({ + force: true, + }); // Type in second rollover alias in input cy.get(`input[placeholder="Rollover alias"]`).focus().type(SECOND_ALIAS); // Click rollover alias modal confirmation button - cy.get(`[data-test-subj="editRolloverAliasModalAddButton"]`).click({ force: true }); + cy.get(`[data-test-subj="editRolloverAliasModalAddButton"]`).click({ + force: true, + }); // Confirm we got rollover alias toaster cy.contains("Edited rollover alias on sample_index"); @@ -182,6 +201,7 @@ describe("Managed indices", () => { describe("can change policies", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createPolicy(POLICY_ID, samplePolicy); cy.createPolicy(POLICY_ID_2, samplePolicy); cy.createIndex(SAMPLE_INDEX, POLICY_ID); @@ -202,7 +222,9 @@ describe("Managed indices", () => { .type(SAMPLE_INDEX, { parseSpecialCharSequences: false, delay: 1 }); // Click the index option - cy.get(`button[title="${SAMPLE_INDEX}"]`).trigger("click", { force: true }); + cy.get(`button[title="${SAMPLE_INDEX}"]`).trigger("click", { + force: true, + }); // Get the third combo search input box which should be the policy input cy.get(`input[data-test-subj="comboBoxSearchInput"]`).eq(2).focus().type(POLICY_ID_2, { parseSpecialCharSequences: false, delay: 1 }); @@ -211,7 +233,9 @@ describe("Managed indices", () => { cy.get(`button[title="${POLICY_ID_2}"]`).click({ force: true }); // Click the Change Policy button - cy.get(`[data-test-subj="changePolicyChangeButton"]`).click({ force: true }); + cy.get(`[data-test-subj="changePolicyChangeButton"]`).click({ + force: true, + }); // Confirm we got the change policy toaster cy.contains("Changed policy on 1 indices"); @@ -236,6 +260,7 @@ describe("Managed indices", () => { describe("can manage data stream indices", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.deleteDataStreams("*"); cy.createPolicy("sample-index-policy", samplePolicy); diff --git a/cypress/integration/policies_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/policies_spec.js similarity index 84% rename from cypress/integration/policies_spec.js rename to cypress/integration/plugins/index-management-dashboards-plugin/policies_spec.js index 92b3d7325..7f4ed8b88 100644 --- a/cypress/integration/policies_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/policies_spec.js @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; -import samplePolicy from "../fixtures/sample_policy"; +import { BASE_PATH, IM_PLUGIN_NAME } from "../../../utils/constants"; +import samplePolicy from "../../../fixtures/plugins/index-management-dashboards-plugin/sample_policy"; const POLICY_ID = "test_policy_id"; @@ -14,7 +14,7 @@ describe("Policies", () => { localStorage.setItem("home:welcome:show", "false"); // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Create policy", { timeout: 60000 }); @@ -23,6 +23,7 @@ describe("Policies", () => { describe("can be created", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); }); it("successfully", () => { @@ -39,18 +40,20 @@ describe("Policies", () => { cy.contains("Continue").click({ force: true }); // Wait for input to load and then type in the policy ID - cy.get(`input[placeholder="example_policy"]`).type(POLICY_ID, { force: true }); + cy.get(`input[placeholder="example_policy"]`).type(POLICY_ID, { + force: true, + }); // Wait for default policy JSON to load cy.contains("A simple default policy"); // Focus JSON input area, clear old policy and type in new policy // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.get(".ace_text-input") - .first() - .focus() - .clear() - .type(JSON.stringify(samplePolicy), { parseSpecialCharSequences: false, delay: 5, timeout: 20000 }); + cy.get(".ace_text-input").first().focus().clear().type(JSON.stringify(samplePolicy), { + parseSpecialCharSequences: false, + delay: 5, + timeout: 20000, + }); // Click the create button cy.get("button").contains("Create").click({ force: true }); @@ -66,12 +69,15 @@ describe("Policies", () => { describe("can be edited", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createPolicy(POLICY_ID, samplePolicy); }); it("successfully", () => { // Make changes to policy JSON for editing confirmation - const newPolicy = { policy: { ...samplePolicy.policy, description: "A new description" } }; + const newPolicy = { + policy: { ...samplePolicy.policy, description: "A new description" }, + }; // Confirm we have our initial policy cy.contains("A simple description"); @@ -93,14 +99,16 @@ describe("Policies", () => { // Focus JSON input area, clear old policy and type in new policy // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.get(".ace_text-input") - .first() - .focus() - .clear() - .type(JSON.stringify(newPolicy), { parseSpecialCharSequences: false, delay: 5, timeout: 20000 }); + cy.get(".ace_text-input").first().focus().clear().type(JSON.stringify(newPolicy), { + parseSpecialCharSequences: false, + delay: 5, + timeout: 20000, + }); // Click Update button - cy.get(`[data-test-subj="createPolicyCreateButton"]`).click({ force: true }); + cy.get(`[data-test-subj="createPolicyCreateButton"]`).click({ + force: true, + }); // Confirm we get toaster saying updated cy.contains(`Updated policy: ${POLICY_ID}`); @@ -113,6 +121,7 @@ describe("Policies", () => { describe("can be deleted", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createPolicy(POLICY_ID, samplePolicy); }); @@ -140,6 +149,7 @@ describe("Policies", () => { describe("can be searched", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); // Create 20+ policies that can be easily sorted alphabetically using letters a-z for (let i = 97; i < 123; i++) { const char = String.fromCharCode(i); @@ -171,17 +181,20 @@ describe("Policies", () => { describe("can be viewed", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createPolicy(POLICY_ID, samplePolicy); }); it("successfully", () => { cy.contains(POLICY_ID); - cy.get(`[data-test-subj="policyLink_${POLICY_ID}"]`).click({ force: true }); + cy.get(`[data-test-subj="policyLink_${POLICY_ID}"]`).click({ + force: true, + }); cy.contains(POLICY_ID); cy.contains(samplePolicy.policy.description); - samplePolicy.policy.states.forEach((state, i) => { + samplePolicy.policy.states.forEach((state) => { cy.contains(state.name); }); diff --git a/cypress/integration/reindex_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/reindex_spec.js similarity index 87% rename from cypress/integration/reindex_spec.js rename to cypress/integration/plugins/index-management-dashboards-plugin/reindex_spec.js index 4f31b0270..30ff3455b 100644 --- a/cypress/integration/reindex_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/reindex_spec.js @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; +import { IM_PLUGIN_NAME, BASE_PATH } from "../../../utils/constants"; const REINDEX_DEST = "test-ecomm-rdx"; const REINDEX_DEST_NO_SOURCE = "test-reindex-nosource"; const REINDEX_NEW_CREATED = "test-logs-new"; @@ -14,7 +14,7 @@ describe("Reindex", () => { localStorage.setItem("home:welcome:show", "false"); // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/indices`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Rows per page", { timeout: 60000 }); @@ -26,7 +26,7 @@ describe("Reindex", () => { // Load ecommerce data cy.request({ method: "POST", - url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/ecommerce`, + url: `${BASE_PATH}/api/sample_data/ecommerce`, headers: { "osd-xsrf": true, }, @@ -69,7 +69,7 @@ describe("Reindex", () => { // Load ecommerce data cy.request({ method: "POST", - url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/ecommerce`, + url: `${BASE_PATH}/api/sample_data/ecommerce`, headers: { "osd-xsrf": true, }, @@ -77,7 +77,9 @@ describe("Reindex", () => { expect(response.status).equal(200); }); - cy.createIndex(REINDEX_DEST, null, { settings: { "index.number_of_replicas": 0 } }); + cy.createIndex(REINDEX_DEST, null, { + settings: { "index.number_of_replicas": 0 }, + }); cy.createPipeline("bumpOrderId", { description: "sample description", @@ -116,10 +118,9 @@ describe("Reindex", () => { cy.get('[data-test-subj="subsetOption"] #subset').click({ force: true }); // input query to reindex subset - cy.get('[data-test-subj="queryJsonEditor"] textarea') - .focus() - .clear() - .type('{"query":{"match":{"category":"Men\'s Clothing"}}}', { parseSpecialCharSequences: false }); + cy.get('[data-test-subj="queryJsonEditor"] textarea').focus().clear().type('{"query":{"match":{"category":"Men\'s Clothing"}}}', { + parseSpecialCharSequences: false, + }); // set slices to auto cy.get('[data-test-subj="sliceEnabled"]').click({ force: true }); @@ -150,7 +151,7 @@ describe("Reindex", () => { // Load logs data cy.request({ method: "POST", - url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/logs`, + url: `${BASE_PATH}/api/sample_data/logs`, headers: { "osd-xsrf": true, }, @@ -183,10 +184,9 @@ describe("Reindex", () => { cy.get('[data-test-subj="subsetOption"] #subset').click({ force: true }); // input query to reindex subset - cy.get('[data-test-subj="queryJsonEditor"] textarea') - .focus() - .clear() - .type('{"query":{"match":{"ip":"135.201.60.64"}}}', { parseSpecialCharSequences: false }); + cy.get('[data-test-subj="queryJsonEditor"] textarea').focus().clear().type('{"query":{"match":{"ip":"135.201.60.64"}}}', { + parseSpecialCharSequences: false, + }); // create destination cy.get('[data-test-subj="createIndexButton"]').click(); @@ -202,7 +202,9 @@ describe("Reindex", () => { cy.wait(10); cy.contains(/have been import successfully/); - cy.get('[data-test-subj="flyout-footer-action-button"]').click({ force: true }); + cy.get('[data-test-subj="flyout-footer-action-button"]').click({ + force: true, + }); // click to perform reindex cy.get('[data-test-subj="reindexConfirmButton"]').click(); diff --git a/cypress/integration/rollover.js b/cypress/integration/plugins/index-management-dashboards-plugin/rollover.js similarity index 78% rename from cypress/integration/rollover.js rename to cypress/integration/plugins/index-management-dashboards-plugin/rollover.js index 4068d3831..3b4578646 100644 --- a/cypress/integration/rollover.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/rollover.js @@ -2,7 +2,7 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; +import { IM_PLUGIN_NAME, BASE_PATH, BACKEND_BASE_PATH } from "../../../utils/constants"; const rolloverValidAlias = "rollover-valid-alias"; const rolloverAliasNeedTargetIndex = "rollover-alias-need-target-index"; @@ -17,14 +17,14 @@ describe("Rollover", () => { cy.deleteTemplate("index-common-template"); cy.deleteAllIndices(); cy.request({ - url: `${Cypress.env("opensearch")}/_data_stream/*`, + url: `${BACKEND_BASE_PATH}/_data_stream/*`, method: "DELETE", failOnStatusCode: false, }); cy.createIndex(validIndex); cy.createIndex(invalidIndex); - cy.addAlias(rolloverValidAlias, validIndex); - cy.addAlias(rolloverAliasNeedTargetIndex, invalidIndex); + cy.addIndexAlias(rolloverValidAlias, validIndex); + cy.addIndexAlias(rolloverAliasNeedTargetIndex, invalidIndex); cy.createIndexTemplate("index-common-template", { index_patterns: ["data-stream-*"], data_stream: {}, @@ -40,7 +40,7 @@ describe("Rollover", () => { }, }); cy.request({ - url: `${Cypress.env("opensearch")}/_data_stream/${rolloverDataStream}`, + url: `${BACKEND_BASE_PATH}/_data_stream/${rolloverDataStream}`, method: "PUT", failOnStatusCode: false, }); @@ -49,7 +49,7 @@ describe("Rollover", () => { describe("rollover", () => { it("rollover data stream successfully", () => { // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/rollover/${rolloverDataStream}`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/rollover/${rolloverDataStream}`); cy.contains("Configure source", { timeout: 60000 }); // click create @@ -60,7 +60,7 @@ describe("Rollover", () => { it("rollover valid alias successfully", () => { // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/rollover/${rolloverValidAlias}`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/rollover/${rolloverValidAlias}`); cy.contains("Configure new rollover index", { timeout: 60000 }); // click create @@ -71,7 +71,7 @@ describe("Rollover", () => { it("rollover invalid alias successfully", () => { // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/rollover/${rolloverAliasNeedTargetIndex}`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/rollover/${rolloverAliasNeedTargetIndex}`); cy.contains("Configure new rollover index", { timeout: 60000 }); // click create @@ -92,7 +92,7 @@ describe("Rollover", () => { cy.deleteTemplate("index-common-template"); cy.deleteAllIndices(); cy.request({ - url: `${Cypress.env("opensearch")}/_data_stream/*`, + url: `${BACKEND_BASE_PATH}/_data_stream/*`, method: "DELETE", failOnStatusCode: false, }); diff --git a/cypress/integration/rollups_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/rollups_spec.js similarity index 87% rename from cypress/integration/rollups_spec.js rename to cypress/integration/plugins/index-management-dashboards-plugin/rollups_spec.js index 427467b02..339ebaee2 100644 --- a/cypress/integration/rollups_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/rollups_spec.js @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; -import sampleRollup from "../fixtures/sample_rollup"; +import { BASE_PATH, IM_PLUGIN_NAME } from "../../../utils/constants"; +import sampleRollup from "../../../fixtures/plugins/index-management-dashboards-plugin/sample_rollup"; const ROLLUP_ID = "test_rollup_id"; @@ -14,27 +14,20 @@ describe("Rollups", () => { localStorage.setItem("home:welcome:show", "true"); // Go to sample data page - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/home#/tutorial_directory`); + cy.visit(`${BASE_PATH}/app/home#/tutorial_directory/sampleData`); - cy.wait(10000) - - // TODO determine why line 25 and/or line 28 are needed occasionally for rollups_spec to pass. - // When the source of the issue is determined they will be removed/uncommented. - - //Click on "Sample data" tab + // Click on "Sample data" tab cy.contains("Sample data").click({ force: true }); - - // Click on "Add data" tab - // cy.contains("Add data").click({ force: true }); - // Load sample eCommerce data - cy.get(`button[data-test-subj="addSampleDataSetecommerce"]`).click({ force: true }); + cy.get(`button[data-test-subj="addSampleDataSetecommerce"]`).click({ + force: true, + }); // Verify that sample data is add by checking toast notification cy.contains("Sample eCommerce orders installed", { timeout: 60000 }); // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/rollups`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/rollups`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Create rollup", { timeout: 60000 }); @@ -43,6 +36,7 @@ describe("Rollups", () => { describe("can be created", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); }); it("successfully", () => { @@ -55,7 +49,9 @@ describe("Rollups", () => { cy.contains("Create rollup").click({ force: true }); // Type in the rollup ID - cy.get(`input[placeholder="my-rollupjob1"]`).type(ROLLUP_ID, { force: true }); + cy.get(`input[placeholder="my-rollupjob1"]`).type(ROLLUP_ID, { + force: true, + }); // Get description input box cy.get(`textarea[data-test-subj="description"]`).focus().type("some description"); @@ -82,15 +78,21 @@ describe("Rollups", () => { cy.get(`input[data-test-subj="comboBoxSearchInput"]`).focus().type("order_date{enter}"); // Add aggregation - cy.get(`button[data-test-subj="addFieldsAggregationEmpty"]`).click({ force: true }); + cy.get(`button[data-test-subj="addFieldsAggregationEmpty"]`).click({ + force: true, + }); // Select a few fields cy.get(`input[data-test-subj="checkboxSelectRow-customer_gender"]`).click({ force: true }); - cy.get(`input[data-test-subj="checkboxSelectRow-day_of_week_i"]`).click({ force: true }); + cy.get(`input[data-test-subj="checkboxSelectRow-day_of_week_i"]`).click({ + force: true, + }); cy.get(`input[data-test-subj="checkboxSelectRow-geoip.city_name"]`).click({ force: true }); // Click the Add button from add fields modal - cy.get(`button[data-test-subj="addFieldsAggregationAdd"]`).click({ force: true }); + cy.get(`button[data-test-subj="addFieldsAggregationAdd"]`).click({ + force: true, + }); // Confirm fields are added cy.contains("customer_gender"); @@ -98,23 +100,37 @@ describe("Rollups", () => { cy.contains("geoip.city_name"); // Add metrics - cy.get(`button[data-test-subj="addFieldsMetricEmpty"]`).click({ force: true }); + cy.get(`button[data-test-subj="addFieldsMetricEmpty"]`).click({ + force: true, + }); // Select a few fields cy.get(`input[data-test-subj="checkboxSelectRow-products.taxless_price"]`).click({ force: true }); - cy.get(`input[data-test-subj="checkboxSelectRow-total_quantity"]`).click({ force: true }); + cy.get(`input[data-test-subj="checkboxSelectRow-total_quantity"]`).click({ + force: true, + }); // Click the Add button from add fields modal - cy.get(`button[data-test-subj="addFieldsMetricAdd"]`).click({ force: true }); + cy.get(`button[data-test-subj="addFieldsMetricAdd"]`).click({ + force: true, + }); // Confirm fields are added cy.contains("products.taxless_price"); cy.contains("total_quantity"); - cy.get(`input[data-test-subj="min-total_quantity"]`).click({ force: true }); - cy.get(`input[data-test-subj="max-total_quantity"]`).click({ force: true }); - cy.get(`input[data-test-subj="sum-total_quantity"]`).click({ force: true }); - cy.get(`input[data-test-subj="all-products.taxless_price"]`).click({ force: true }); + cy.get(`input[data-test-subj="min-total_quantity"]`).click({ + force: true, + }); + cy.get(`input[data-test-subj="max-total_quantity"]`).click({ + force: true, + }); + cy.get(`input[data-test-subj="sum-total_quantity"]`).click({ + force: true, + }); + cy.get(`input[data-test-subj="all-products.taxless_price"]`).click({ + force: true, + }); // Click the next button cy.get("button").contains("Next").click({ force: true }); @@ -139,6 +155,7 @@ describe("Rollups", () => { describe("can be edited", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createRollup(ROLLUP_ID, sampleRollup); }); @@ -161,13 +178,17 @@ describe("Rollups", () => { cy.get(`textArea[data-test-subj="description"]`).focus().clear().type("A new description"); // Click Save changes button - cy.get(`[data-test-subj="editRollupSaveChangesButton"]`).click({ force: true }); + cy.get(`[data-test-subj="editRollupSaveChangesButton"]`).click({ + force: true, + }); // Confirm we get toaster saying changes saved cy.contains(`Changes to "${ROLLUP_ID}" saved!`); // Click into rollup job details page - cy.get(`[data-test-subj="rollupLink_${ROLLUP_ID}"]`).click({ force: true }); + cy.get(`[data-test-subj="rollupLink_${ROLLUP_ID}"]`).click({ + force: true, + }); // Confirm new description shows in details page cy.contains("A new description"); @@ -177,6 +198,7 @@ describe("Rollups", () => { describe("can be deleted", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createRollup(ROLLUP_ID, sampleRollup); }); @@ -212,6 +234,7 @@ describe("Rollups", () => { describe("can be enabled and disabled", () => { before(() => { cy.deleteAllIndices(); + cy.deleteIMJobs(); cy.createRollup(ROLLUP_ID, sampleRollup); }); @@ -220,7 +243,9 @@ describe("Rollups", () => { cy.contains(ROLLUP_ID); // Click into rollup job details page - cy.get(`[data-test-subj="rollupLink_${ROLLUP_ID}"]`).click({ force: true }); + cy.get(`[data-test-subj="rollupLink_${ROLLUP_ID}"]`).click({ + force: true, + }); cy.contains(`${ROLLUP_ID}`); @@ -228,13 +253,17 @@ describe("Rollups", () => { cy.get(`[data-test-subj="disableButton"]`).should("not.be.disabled"); // Click Disable button - cy.get(`[data-test-subj="disableButton"]`).trigger("click", { force: true }); + cy.get(`[data-test-subj="disableButton"]`).trigger("click", { + force: true, + }); // Confirm we get toaster saying rollup job is disabled cy.contains(`${ROLLUP_ID} is disabled`); // Click Enable button - cy.get(`[data-test-subj="enableButton"]`).trigger("click", { force: true }); + cy.get(`[data-test-subj="enableButton"]`).trigger("click", { + force: true, + }); // Confirm we get toaster saying rollup job is enabled cy.contains(`${ROLLUP_ID} is enabled`); diff --git a/cypress/integration/snapshots_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/snapshots_spec.js similarity index 92% rename from cypress/integration/snapshots_spec.js rename to cypress/integration/plugins/index-management-dashboards-plugin/snapshots_spec.js index d36b1fc00..51560333a 100644 --- a/cypress/integration/snapshots_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/snapshots_spec.js @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; +import { IM_PLUGIN_NAME, BASE_PATH } from "../../../utils/constants"; describe("Snapshots", () => { before(() => { @@ -11,7 +11,7 @@ describe("Snapshots", () => { localStorage.setItem("home:welcome:show", "false"); // Visit ISM Snapshots Dashboard - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/snapshots`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/snapshots`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Restore", { timeout: 60000 }); @@ -20,7 +20,7 @@ describe("Snapshots", () => { describe("Repository can be created", () => { it("successfully creates a new repository", () => { // Create repository to store snapshots - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/repositories`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/repositories`); // Route to create repository page cy.contains("Create repository").click({ force: true }); @@ -41,7 +41,7 @@ describe("Snapshots", () => { describe("Snapshot can be created", () => { it("successfully creates a new snapshot", () => { - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/snapshots`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/snapshots`); // delete any existing indices cy.deleteAllIndices(); @@ -51,7 +51,7 @@ describe("Snapshots", () => { cy.createIndex("test_index_2"); cy.createIndex("test_index_3"); - // wait needed here to enable cypress to find "Take snapshot" button. Timeout + // wait needed here to enable cypress to find "Take snapshot" button. Timeout // cannot be used with cy.createIndex cy.wait(5000); @@ -124,5 +124,5 @@ describe("Snapshots", () => { cy.contains("Deleted snapshot"); cy.contains("No items found"); }); - }) + }); }); diff --git a/cypress/integration/split_index.js b/cypress/integration/plugins/index-management-dashboards-plugin/split_index.js similarity index 95% rename from cypress/integration/split_index.js rename to cypress/integration/plugins/index-management-dashboards-plugin/split_index.js index 39485be92..7024a321a 100644 --- a/cypress/integration/split_index.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/split_index.js @@ -2,7 +2,7 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; +import { IM_PLUGIN_NAME, BASE_PATH } from "../../../utils/constants"; const sampleIndex = "index-split"; const sampleAlias = "alias-split"; @@ -17,7 +17,7 @@ describe("Split Index", () => { describe("can be created and updated", () => { beforeEach(() => { // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/indices`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`); cy.contains("Rows per page", { timeout: 60000 }); }); @@ -50,7 +50,9 @@ describe("Split Index", () => { 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.updateIndexSettings(sampleIndex, { + "index.blocks.write": "true", + }).end(); }); // create index it("Split successfully", () => { @@ -157,7 +159,9 @@ describe("Split Index", () => { it("Update blocks write to true", () => { // Set index to not blocks write - cy.updateIndexSettings(sampleIndex, { "index.blocks.write": "false" }).end(); + cy.updateIndexSettings(sampleIndex, { + "index.blocks.write": "false", + }).end(); cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`) .click() .end() diff --git a/cypress/integration/templates.js b/cypress/integration/plugins/index-management-dashboards-plugin/templates.js similarity index 96% rename from cypress/integration/templates.js rename to cypress/integration/plugins/index-management-dashboards-plugin/templates.js index c0743a8cf..22587f838 100644 --- a/cypress/integration/templates.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/templates.js @@ -2,7 +2,7 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; +import { IM_PLUGIN_NAME, BASE_PATH } from "../../../utils/constants"; const SAMPLE_TEMPLATE_PREFIX = "index-for-alias-test"; const MAX_TEMPLATE_NUMBER = 30; @@ -30,7 +30,7 @@ describe("Templates", () => { beforeEach(() => { // Visit ISM OSD - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/templates`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/templates`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Rows per page", { timeout: 60000 }); diff --git a/cypress/integration/transforms_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/transforms_spec.js similarity index 66% rename from cypress/integration/transforms_spec.js rename to cypress/integration/plugins/index-management-dashboards-plugin/transforms_spec.js index ea1439932..d8d2d449d 100644 --- a/cypress/integration/transforms_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/transforms_spec.js @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { PLUGIN_NAME } from "../support/constants"; -import sampleTransform from "../fixtures/sample_transform"; +import { BASE_PATH, IM_PLUGIN_NAME } from "../../../utils/constants"; +import sampleTransform from "../../../fixtures/plugins/index-management-dashboards-plugin/sample_transform"; const TRANSFORM_ID = "test_transform_id"; @@ -12,11 +12,12 @@ describe("Transforms", () => { before(() => { // Delete all indices cy.deleteAllIndices(); + cy.deleteIMJobs(); // Load ecommerce data cy.request({ method: "POST", - url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/ecommerce`, + url: `${BASE_PATH}/api/sample_data/ecommerce`, headers: { "osd-xsrf": true, }, @@ -27,15 +28,15 @@ describe("Transforms", () => { beforeEach(() => { // delete test transform and index - cy.request("DELETE", `${Cypress.env("opensearch")}/test_transform*`); + cy.request("DELETE", `${Cypress.env("openSearchUrl")}/test_transform*`); cy.request({ method: "POST", - url: `${Cypress.env("opensearch")}/_plugins/_transform/${TRANSFORM_ID}/_stop`, + url: `${Cypress.env("openSearchUrl")}/_plugins/_transform/${TRANSFORM_ID}/_stop`, failOnStatusCode: false, }); cy.request({ method: "DELETE", - url: `${Cypress.env("opensearch")}/_plugins/_transform/${TRANSFORM_ID} `, + url: `${Cypress.env("openSearchUrl")}/_plugins/_transform/${TRANSFORM_ID} `, failOnStatusCode: false, }); @@ -43,7 +44,7 @@ describe("Transforms", () => { localStorage.setItem("home:welcome:show", true); // Visit ISM Transforms Dashboard - cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/transforms`); + cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/transforms`); // Common text to wait for to confirm page loaded, give up to 60 seconds for initial load cy.contains("Create transform", { timeout: 60000 }); @@ -58,7 +59,9 @@ describe("Transforms", () => { cy.contains("Create transform").click({ force: true }); // Type in transform ID - cy.get(`input[placeholder="my-transformjob1"]`).type(TRANSFORM_ID, { force: true }); + cy.get(`input[placeholder="my-transformjob1"]`).type(TRANSFORM_ID, { + force: true, + }); // Get description input box cy.get(`textarea[data-test-subj="description"]`).focus().type("some description"); @@ -81,7 +84,9 @@ describe("Transforms", () => { // Confirm that we got to step 2 of creation page cy.contains("Select fields to transform"); - cy.get(`button[data-test-subj="category.keywordOptionsPopover"]`).click({ force: true }); + cy.get(`button[data-test-subj="category.keywordOptionsPopover"]`).click({ + force: true, + }); cy.contains("Group by terms").click({ force: true }); @@ -134,7 +139,9 @@ describe("Transforms", () => { cy.contains(TRANSFORM_ID); // Select checkbox for our transform - cy.get(`#_selection_column_${TRANSFORM_ID}-checkbox`).check({ force: true }); + cy.get(`#_selection_column_${TRANSFORM_ID}-checkbox`).check({ + force: true, + }); // Click on Actions popover menu cy.get(`[data-test-subj="actionButton"]`).click({ force: true }); @@ -148,13 +155,17 @@ describe("Transforms", () => { cy.get(`textArea[data-test-subj="description"]`).focus().clear().type("A new description"); // Click Save changes button - cy.get(`[data-test-subj="editTransformSaveButton"]`).click({ force: true }); + cy.get(`[data-test-subj="editTransformSaveButton"]`).click({ + force: true, + }); // Confirm we get toaster saying changes saved cy.contains(`Changes to transform saved`); // Click into transform job details page - cy.get(`[data-test-subj="transformLink_${TRANSFORM_ID}"]`).click({ force: true }); + cy.get(`[data-test-subj="transformLink_${TRANSFORM_ID}"]`).click({ + force: true, + }); // Confirm new description shows in details page cy.contains("A new description"); @@ -172,12 +183,16 @@ describe("Transforms", () => { cy.contains(TRANSFORM_ID); // Disable transform - cy.get(`#_selection_column_${TRANSFORM_ID}-checkbox`).check({ force: true }); + cy.get(`#_selection_column_${TRANSFORM_ID}-checkbox`).check({ + force: true, + }); cy.get(`[data-test-subj="disableButton"]`).click({ force: true }); cy.contains(`"${TRANSFORM_ID}" is disabled`); // Select checkbox for our transform job - cy.get(`#_selection_column_${TRANSFORM_ID}-checkbox`).check({ force: true }); + cy.get(`#_selection_column_${TRANSFORM_ID}-checkbox`).check({ + force: true, + }); // Click on Actions popover menu cy.get(`[data-test-subj="actionButton"]`).click({ force: true }); @@ -210,7 +225,9 @@ describe("Transforms", () => { cy.contains(TRANSFORM_ID); // Click into transform job details page - cy.get(`[data-test-subj="transformLink_${TRANSFORM_ID}"]`).click({ force: true }); + cy.get(`[data-test-subj="transformLink_${TRANSFORM_ID}"]`).click({ + force: true, + }); cy.contains(`${TRANSFORM_ID}`); @@ -241,87 +258,4 @@ describe("Transforms", () => { cy.contains(`"${TRANSFORM_ID}" is enabled`); }); }); - - describe("can be created in continuous mode", () => { - it("successfully", () => { - // Confirm we loaded empty state - cy.contains("Transform jobs help you create a materialized view on top of existing data."); - - // Route to create transform page - cy.contains("Create transform").click({ force: true }); - - // Type in transform ID - cy.get(`input[placeholder="my-transformjob1"]`).type(TRANSFORM_ID, { force: true }); - - // Get description input box - cy.get(`textarea[data-test-subj="description"]`).focus().type("some description"); - - // Enter source index - cy.get(`div[data-test-subj="sourceIndexCombobox"]`) - .find(`input[data-test-subj="comboBoxSearchInput"]`) - .focus() - .type("opensearch_dashboards_sample_data_ecommerce{enter}"); - - // Enter target index - cy.get(`div[data-test-subj="targetIndexCombobox"]`) - .find(`input[data-test-subj="comboBoxSearchInput"]`) - .focus() - .type("test_transform{enter}"); - - // Click the next button - cy.get("button").contains("Next").click({ force: true }); - - // Confirm that we got to step 2 of creation page - cy.contains("Select fields to transform"); - - cy.get(`button[data-test-subj="category.keywordOptionsPopover"]`).click({ force: true }); - - cy.contains("Group by terms").click({ force: true }); - - // Confirm group was added - cy.contains("category.keyword_terms"); - - // Add aggregable field - cy.contains("50 columns hidden").click({ force: true }); - cy.contains("taxless_total_price").click({ force: true }); - // Click out of the window - cy.contains("Select fields to transform").click({ force: true }); - - cy.get(`button[data-test-subj="taxless_total_priceOptionsPopover"]`).click({ force: true }); - - cy.contains("Aggregate by avg").click({ force: true }); - - // Confirm agg was added - cy.contains("avg_taxless_total_price"); - - // Click the next button - cy.get("button").contains("Next").click({ force: true }); - - // Confirm that we got to step 3 of creation page - cy.contains("Job enabled by default"); - - // Make the transform continuous - cy.get("[id=yes]").click({ force: true }); - - // Click the next button - cy.get("button").contains("Next").click({ force: true }); - - // Confirm that we got to step 4 of creation page - cy.contains("Review and create"); - - // Confirm that the transform is continuous - cy.contains("Continuous, every"); - - // Click the create button - cy.get("button").contains("Create").click({ force: true }); - - // Verify that sample data is add by checking toast notification - cy.contains(`Transform job "${TRANSFORM_ID}" successfully created.`); - cy.location("hash").should("contain", "transforms"); - cy.get(`button[data-test-subj="transformLink_${TRANSFORM_ID}"]`); - - // The continuous column should say 'Yes' - cy.contains("Yes"); - }); - }); }); diff --git a/cypress/support/commands.js b/cypress/support/commands.js deleted file mode 100644 index 5e8cf088f..000000000 --- a/cypress/support/commands.js +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -const { API, INDEX, ADMIN_AUTH } = require("./constants"); -const { NODE_API } = require("../../server/utils/constants"); - -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add("login", (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) - -Cypress.Commands.overwrite("visit", (originalFn, url, options) => { - // Add the basic auth header when security enabled in the Opensearch cluster - // https://github.com/cypress-io/cypress/issues/1288 - if (Cypress.env("security_enabled")) { - const ADMIN_AUTH = { - username: Cypress.env("username"), - password: Cypress.env("password"), - }; - if (options) { - options.auth = ADMIN_AUTH; - } else { - options = { auth: ADMIN_AUTH }; - } - // Add query parameters - select the default OSD tenant - options.qs = { security_tenant: "private" }; - return originalFn(url, options); - } else { - return originalFn(url, options); - } -}); - -// Be able to add default options to cy.request(), https://github.com/cypress-io/cypress/issues/726 -Cypress.Commands.overwrite("request", (originalFn, ...args) => { - let defaults = {}; - // Add the basic authentication header when security enabled in the Opensearch cluster - const ADMIN_AUTH = { - username: Cypress.env("username"), - password: Cypress.env("password"), - }; - if (Cypress.env("security_enabled")) { - defaults.auth = ADMIN_AUTH; - } - - let options = {}; - if (typeof args[0] === "object" && args[0] !== null) { - options = Object.assign({}, args[0]); - } else if (args.length === 1) { - [options.url] = args; - } else if (args.length === 2) { - [options.method, options.url] = args; - } else if (args.length === 3) { - [options.method, options.url, options.body] = args; - } - - return originalFn(Object.assign({}, defaults, options)); -}); - -Cypress.Commands.add("deleteAllIndices", () => { - cy.request("DELETE", `${Cypress.env("opensearch")}/index*,sample*,opensearch_dashboards*,test*`); - cy.request("DELETE", `${Cypress.env("opensearch")}/.opendistro-ism*?expand_wildcards=all`); -}); - -Cypress.Commands.add("createPolicy", (policyId, policyJSON) => { - cy.request("PUT", `${Cypress.env("opensearch")}${API.POLICY_BASE}/${policyId}`, policyJSON); -}); - -Cypress.Commands.add("getIndexSettings", (index) => { - cy.request("GET", `${Cypress.env("opensearch")}/${index}/_settings`); -}); - -Cypress.Commands.add("updateIndexSettings", (index, settings) => { - cy.request("PUT", `${Cypress.env("opensearch")}/${index}/_settings`, settings); -}); - -Cypress.Commands.add("updateManagedIndexConfigStartTime", (index) => { - // Creating closure over startTime so it's not calculated until actual update_by_query call - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(1000).then(() => { - const FIVE_MINUTES_MILLIS = 5 * 60 * 1000; // Default ISM job interval - const THREE_SECONDS_MILLIS = 3000; // Subtract 3 seconds to account for buffer of updating doc, descheduling, rescheduling - const startTime = new Date().getTime() - (FIVE_MINUTES_MILLIS - THREE_SECONDS_MILLIS); - const body = { - query: { term: { "managed_index.index": index } }, - script: { - lang: "painless", - source: `ctx._source['managed_index']['schedule']['interval']['start_time'] = ${startTime}L`, - }, - }; - cy.request("POST", `${Cypress.env("opensearch")}/${INDEX.OPENDISTRO_ISM_CONFIG}/_update_by_query`, body); - }); -}); - -Cypress.Commands.add("createIndex", (index, policyID = null, settings = {}) => { - cy.request("PUT", `${Cypress.env("opensearch")}/${index}`, settings); - if (policyID != null) { - const body = { policy_id: policyID }; - cy.request("POST", `${Cypress.env("opensearch")}${API.ADD_POLICY_BASE}/${index}`, body); - } -}); - -Cypress.Commands.add("deleteSnapshot", (repository, snapshot) => { - cy.request("DELETE", `${Cypress.env("opensearch")}${NODE_API._SNAPSHOTS}/${repository}/${snapshot}`); -}); - -Cypress.Commands.add("createRollup", (rollupId, rollupJSON) => { - cy.request("PUT", `${Cypress.env("opensearch")}${API.ROLLUP_JOBS_BASE}/${rollupId}`, rollupJSON); -}); - -Cypress.Commands.add("createIndexTemplate", (name, template) => { - cy.request("PUT", `${Cypress.env("opensearch")}${API.INDEX_TEMPLATE_BASE}/${name}`, template); -}); - -Cypress.Commands.add("deleteTemplate", (name) => { - cy.request({ - url: `${Cypress.env("opensearch")}${API.INDEX_TEMPLATE_BASE}/${name}`, - failOnStatusCode: false, - method: "DELETE", - }); -}); - -Cypress.Commands.add("createDataStream", (name) => { - cy.request("PUT", `${Cypress.env("opensearch")}${API.DATA_STREAM_BASE}/${name}`); -}); - -Cypress.Commands.add("deleteDataStreams", (names) => { - cy.request("DELETE", `${Cypress.env("opensearch")}${API.DATA_STREAM_BASE}/${names}`); -}); - -Cypress.Commands.add("rollover", (target) => { - cy.request("POST", `${Cypress.env("opensearch")}/${target}/_rollover`); -}); - -Cypress.Commands.add("createTransform", (transformId, transformJSON) => { - cy.request("PUT", `${Cypress.env("opensearch")}${API.TRANSFORM_JOBS_BASE}/${transformId}`, transformJSON); -}); - -Cypress.Commands.add("createPipeline", (pipelineId, pipelineJSON) => { - cy.request("PUT", `${Cypress.env("opensearch")}/_ingest/pipeline/${pipelineId}`, pipelineJSON); -}); - -Cypress.Commands.add("disableJitter", () => { - // Sets the jitter to 0 in the ISM plugin cluster settings - const jitterJson = { - persistent: { - plugins: { - index_state_management: { - jitter: "0.0", - }, - }, - }, - }; - cy.request("PUT", `${Cypress.env("opensearch")}/_cluster/settings`, jitterJson); -}); - -Cypress.Commands.add("addAlias", (alias, index) => { - cy.request({ - url: `${Cypress.env("opensearch")}/_aliases`, - method: "POST", - body: { - actions: [ - { - add: { - index, - alias, - }, - }, - ], - }, - failOnStatusCode: false, - }); -}); - -Cypress.Commands.add("removeAlias", (alias) => { - cy.request({ - url: `${Cypress.env("opensearch")}/_aliases`, - method: "POST", - body: { - actions: [ - { - remove: { - index: "*", - alias, - }, - }, - ], - }, - failOnStatusCode: false, - }); -}); diff --git a/cypress/support/constants.js b/cypress/support/constants.js deleted file mode 100644 index 25647a798..000000000 --- a/cypress/support/constants.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -export const API_ROUTE_PREFIX = "/_plugins/_ism"; -export const API_ROUTE_PREFIX_ROLLUP = "/_plugins/_rollup"; -export const API_ROUTE_PREFIX_TRANSFORM = "/_plugins/_transform"; - -export const INDEX = { - OPENDISTRO_ISM_CONFIG: ".opendistro-ism-config", -}; - -export const API = { - INDEX_TEMPLATE_BASE: "/_index_template", - DATA_STREAM_BASE: "/_data_stream", - POLICY_BASE: `${API_ROUTE_PREFIX}/policies`, - EXPLAIN_BASE: `${API_ROUTE_PREFIX}/explain`, - RETRY_BASE: `${API_ROUTE_PREFIX}/retry`, - ADD_POLICY_BASE: `${API_ROUTE_PREFIX}/add`, - REMOVE_POLICY_BASE: `${API_ROUTE_PREFIX}/remove`, - CHANGE_POLICY_BASE: `${API_ROUTE_PREFIX}/change_policy`, - ROLLUP_JOBS_BASE: `${API_ROUTE_PREFIX_ROLLUP}/jobs`, - TRANSFORM_JOBS_BASE: `${API_ROUTE_PREFIX_TRANSFORM}`, -}; - -export const PLUGIN_NAME = "opensearch_index_management_dashboards"; diff --git a/cypress/support/index.d.ts b/cypress/support/index.d.ts index 0054853f6..9fb52ed97 100644 --- a/cypress/support/index.d.ts +++ b/cypress/support/index.d.ts @@ -118,7 +118,7 @@ declare namespace Cypress { * cy.createPipeline("pipelineId", {"description": "sample description", "processors": []}) */ createPipeline(pipelineId: string, pipeline: object); - addAlias(alias: string, index: string); - removeAlias(alias: string); + addIndexAlias(alias: string, index: string); + removeIndexAlias(alias: string); } } diff --git a/cypress/support/index.js b/cypress/support/index.js index 1f2b57715..a54764942 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -19,7 +19,8 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import "./commands"; +import "../utils/commands"; +import "../utils/plugins/index-management-dashboards-plugin/commands"; // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/cypress/utils/base_constants.js b/cypress/utils/base_constants.js new file mode 100644 index 000000000..f0089a2ee --- /dev/null +++ b/cypress/utils/base_constants.js @@ -0,0 +1,7 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export const BASE_PATH = Cypress.config("baseUrl"); +export const BACKEND_BASE_PATH = Cypress.env("openSearchUrl"); diff --git a/cypress/utils/commands.js b/cypress/utils/commands.js new file mode 100644 index 000000000..819ea40be --- /dev/null +++ b/cypress/utils/commands.js @@ -0,0 +1,364 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { BASE_PATH, IM_API } from "./constants"; + +export const ADMIN_AUTH = { + username: Cypress.env("username"), + password: Cypress.env("password"), + set newUser(changedUsername) { + this.username = changedUsername; + }, + set newPassword(changedPassword) { + this.password = changedPassword; + }, +}; + +export const CURRENT_TENANT = { + defaultTenant: "private", + set newTenant(changedTenant) { + this.defaultTenant = changedTenant; + }, +}; + +export const supressNoRequestOccurred = () => { + cy.on("fail", (err) => { + if (err.message.includes("No request ever occurred.")) return false; + }); +}; + +// TODO: Add commands to ./index.d.ts for IDE discoverability + +/** + * This overwrites the default visit command to authenticate before visiting + * webpages if SECURITY_ENABLED cypress env var is true + */ +Cypress.Commands.overwrite("visit", (orig, url, options) => { + if (Cypress.env("SECURITY_ENABLED")) { + let newOptions = options; + let waitForGetTenant = options && options.waitForGetTenant; + if (options) { + newOptions["auth"] = ADMIN_AUTH; + } else { + newOptions = { + auth: ADMIN_AUTH, + }; + } + newOptions.qs = { security_tenant: CURRENT_TENANT.defaultTenant }; + if (waitForGetTenant) { + cy.intercept("GET", "/api/v1/multitenancy/tenant").as("getTenant"); + orig(url, newOptions); + supressNoRequestOccurred(); + cy.wait("@getTenant"); + } else { + orig(url, newOptions); + } + } else { + orig(url, options); + } +}); + +/** + * Overwrite request command to support authentication similar to visit. + * The request function parameters can be url, or (method, url), or (method, url, body). + */ +Cypress.Commands.overwrite("request", (originalFn, ...args) => { + let defaults = {}; + if (Cypress.env("SECURITY_ENABLED")) { + defaults.auth = ADMIN_AUTH; + } + + let options = {}; + if (typeof args[0] === "object" && args[0] !== null) { + options = Object.assign({}, args[0]); + } else if (args.length === 1) { + [options.url] = args; + } else if (args.length === 2) { + [options.method, options.url] = args; + } else if (args.length === 3) { + [options.method, options.url, options.body] = args; + } + + return originalFn(Object.assign({}, defaults, options)); +}); + +Cypress.Commands.add("login", () => { + // much faster than log in through UI + cy.request({ + method: "POST", + url: `${BASE_PATH}/auth/login`, + body: ADMIN_AUTH, + headers: { + "osd-xsrf": true, + }, + }); +}); + +Cypress.Commands.add("deleteAllIndices", () => { + cy.log("Deleting all indices"); + cy.request("DELETE", `${Cypress.env("openSearchUrl")}/index*,sample*,opensearch_dashboards*`); + cy.request("DELETE", `${Cypress.env("openSearchUrl")}/.opendistro-ism*?expand_wildcards=all`); +}); + +Cypress.Commands.add("deleteADSystemIndices", () => { + cy.log("Deleting AD system indices"); + cy.request("DELETE", `${Cypress.env("openSearchUrl")}/.opendistro-anomaly*`); +}); + +Cypress.Commands.add("getIndexSettings", (index) => { + cy.request("GET", `${Cypress.env("openSearchUrl")}/${index}/_settings`); +}); + +Cypress.Commands.add("updateIndexSettings", (index, settings) => { + cy.request("PUT", `${Cypress.env("openSearchUrl")}/${index}/_settings`, settings); +}); + +Cypress.Commands.add("createIndexTemplate", (name, template) => { + cy.request("PUT", `${Cypress.env("openSearchUrl")}${IM_API.INDEX_TEMPLATE_BASE}/${name}`, template); +}); + +Cypress.Commands.add("createDataStream", (name) => { + cy.request("PUT", `${Cypress.env("openSearchUrl")}${IM_API.DATA_STREAM_BASE}/${name}`); +}); + +Cypress.Commands.add("deleteDataStreams", (names) => { + cy.request("DELETE", `${Cypress.env("openSearchUrl")}${IM_API.DATA_STREAM_BASE}/${names}`); +}); + +Cypress.Commands.add("rollover", (target) => { + cy.request("POST", `${Cypress.env("openSearchUrl")}/${target}/_rollover`); +}); + +// --- Typed commands -- + +Cypress.Commands.add("getElementByTestId", (testId, options = {}) => { + return cy.get(`[data-test-subj="${testId}"]`, options); +}); + +Cypress.Commands.add("createIndex", (index, policyID = null, settings = {}) => { + cy.request("PUT", `${Cypress.env("openSearchUrl")}/${index}`, settings); + if (policyID != null) { + const body = { policy_id: policyID }; + + cy.request("POST", `${Cypress.env("openSearchUrl")}${IM_API.ADD_POLICY_BASE}/${index}`, body); + } +}); + +Cypress.Commands.add("deleteIndex", (indexName, options = {}) => { + cy.request({ + method: "DELETE", + url: `${Cypress.env("openSearchUrl")}/${indexName}`, + failOnStatusCode: false, + ...options, + }); +}); + +// TODO: Impliment chunking +Cypress.Commands.add("bulkUploadDocs", (fixturePath, index) => { + const sendBulkAPIRequest = (ndjson) => { + const url = index ? `${Cypress.env("openSearchUrl")}/${index}/_bulk` : `${Cypress.env("openSearchUrl")}/_bulk`; + cy.log("bulkUploadDocs") + .request({ + method: "POST", + url, + headers: { + "content-type": "application/json;charset=UTF-8", + "osd-xsrf": true, + }, + body: ndjson, + }) + .then((response) => { + if (response.body.errors) { + console.error(response.body.items); + throw new Error("Bulk upload failed"); + } + }); + }; + + cy.fixture(fixturePath, "utf8").then((ndjson) => { + sendBulkAPIRequest(ndjson); + }); + + cy.request({ + method: "POST", + url: `${Cypress.env("openSearchUrl")}/_all/_refresh`, + }); +}); + +Cypress.Commands.add("importSavedObjects", (fixturePath, overwrite = true) => { + const sendImportRequest = (ndjson) => { + const url = `${Cypress.config().baseUrl}/api/saved_objects/_import?${overwrite ? `overwrite=true` : ""}`; + + const formData = new FormData(); + formData.append("file", ndjson, "savedObject.ndjson"); + + cy.log("importSavedObject") + .request({ + method: "POST", + url, + headers: { + "content-type": "multipart/form-data", + "osd-xsrf": true, + }, + body: formData, + }) + .then((response) => { + if (response.body.errors) { + console.error(response.body.items); + throw new Error("Import failed"); + } + }); + }; + + cy.fixture(fixturePath) + .then((file) => Cypress.Blob.binaryStringToBlob(file)) + .then((ndjson) => { + sendImportRequest(ndjson); + }); +}); + +Cypress.Commands.add("deleteSavedObject", (type, id, options = {}) => { + const url = `${Cypress.config().baseUrl}/api/saved_objects/${type}/${id}`; + + return cy.request({ + method: "DELETE", + url, + headers: { + "osd-xsrf": true, + }, + failOnStatusCode: false, + ...options, + }); +}); + +Cypress.Commands.add("deleteSavedObjectByType", (type, search) => { + const searchParams = new URLSearchParams({ + fields: "id", + type, + }); + + if (search) { + searchParams.set("search", search); + } + + const url = `${Cypress.config().baseUrl}/api/opensearch-dashboards/management/saved_objects/_find?${searchParams.toString()}`; + + return cy.request(url).then((response) => { + console.log("response", response); + response.body.saved_objects.map(({ type, id }) => { + cy.deleteSavedObject(type, id); + }); + }); +}); + +Cypress.Commands.add("createIndexPattern", (id, attributes, header = {}) => { + const url = `${Cypress.config().baseUrl}/api/saved_objects/index-pattern/${id}`; + + cy.request({ + method: "POST", + url, + headers: { + "content-type": "application/json;charset=UTF-8", + "osd-xsrf": true, + ...header, + }, + body: JSON.stringify({ + attributes, + references: [], + }), + }); +}); + +Cypress.Commands.add("deleteIndexPattern", (id, options = {}) => cy.deleteSavedObject("index-pattern", id, options)); + +Cypress.Commands.add("setAdvancedSetting", (changes) => { + const url = `${Cypress.config().baseUrl}/api/opensearch-dashboards/settings`; + cy.log("setAdvancedSetting") + .request({ + method: "POST", + url, + headers: { + "content-type": "application/json;charset=UTF-8", + "osd-xsrf": true, + }, + body: { changes }, + }) + .then((response) => { + if (response.body.errors) { + console.error(response.body.items); + throw new Error("Setting advanced setting failed"); + } + }); +}); + +Cypress.Commands.add("drag", { prevSubject: true }, (source, targetSelector) => { + const opts = { log: false }; + const dataTransfer = new DataTransfer(); + const DELAY = 5; // in ms + const MAX_TRIES = 3; + const initalRect = source.get(0).getBoundingClientRect(); + let target; + let count = 0; + let moved = false; + + const log = Cypress.log({ + name: "Drag and Drop", + displayName: "drag", + type: "child", + autoEnd: false, + message: targetSelector, + }); + + const getHasMoved = () => { + const currentRect = source.get(0).getBoundingClientRect(); + + return !(initalRect.top === currentRect.top && initalRect.left === currentRect.left); + }; + + const dragOver = () => { + if (count < MAX_TRIES && !moved) { + count += 1; + return cy + .wrap(target, opts) + .trigger("dragover", { + dataTransfer, + eventConstructor: "DragEvent", + ...opts, + }) + .wait(DELAY, opts) + .then(() => { + moved = getHasMoved(); + return dragOver(); + }); + } else { + return true; + } + }; + + cy.get(targetSelector, opts) + .then((targetEle) => { + target = targetEle; + + return target; + }) + .then(() => { + return cy.wrap(source, opts).trigger("dragstart", { + dataTransfer, + eventConstructor: "DragEvent", + ...opts, + }); + }) + .then(() => dragOver()) + .then(() => { + return cy.wrap(target, opts).trigger("drop", { + dataTransfer, + eventConstructor: "DragEvent", + ...opts, + }); + }) + .then(() => { + log.end(); + }); +}); diff --git a/cypress/utils/constants.js b/cypress/utils/constants.js new file mode 100644 index 000000000..e5eb4f51f --- /dev/null +++ b/cypress/utils/constants.js @@ -0,0 +1,7 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from "./base_constants"; +export * from "./plugins/index-management-dashboards-plugin/constants"; diff --git a/cypress/utils/plugins/index-management-dashboards-plugin/commands.js b/cypress/utils/plugins/index-management-dashboards-plugin/commands.js new file mode 100644 index 000000000..5c4842505 --- /dev/null +++ b/cypress/utils/plugins/index-management-dashboards-plugin/commands.js @@ -0,0 +1,119 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { BACKEND_BASE_PATH, IM_API, IM_CONFIG_INDEX } from "../../constants"; + +Cypress.Commands.add("deleteIMJobs", () => { + // // TODO don't directly delete system index, use other way + // cy.request("DELETE", `${Cypress.env("openSearchUrl")}/.opendistro-ism*?expand_wildcards=all`); + // // Clean all ISM policies + // cy.request("GET", `${BACKEND_BASE_PATH}${IM_API.POLICY_BASE}`).then((resp) => { + // const policyIds = resp.body.policies.map((item) => item._id).join(", "); + // if (policyIds.length) { + // cy.request("DELETE", `${BACKEND_BASE_PATH}${IM_API.POLICY_BASE}/${policyIds}`); + // } + // }); + // // Clean all ISM jobs + // cy.request("GET", `${BACKEND_BASE_PATH}${IM_API.EXPLAIN_BASE}`).then((resp) => { + // let ismJobIds = Object.keys(resp.body); + // ismJobIds = ismJobIds.filter((e) => e !== "total_managed_indices").join(", "); + // if (ismJobIds.length) { + // cy.request("POST", `${BACKEND_BASE_PATH}${IM_API.REMOVE_POLICY_BASE}/${ismJobIds}`); + // } + // }); +}); + +Cypress.Commands.add("createPolicy", (policyId, policyJSON) => { + cy.request("PUT", `${Cypress.env("openSearchUrl")}${IM_API.POLICY_BASE}/${policyId}`, policyJSON); +}); + +Cypress.Commands.add("updateManagedIndexConfigStartTime", (index) => { + // TODO directly changing system index will not be supported, need to introduce new way + // Creating closure over startTime so it's not calculated until actual update_by_query call + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(1000).then(() => { + const FIVE_MINUTES_MILLIS = 5 * 60 * 1000; // Default ISM job interval + const THREE_SECONDS_MILLIS = 3000; // Subtract 3 seconds to account for buffer of updating doc, descheduling, rescheduling + const startTime = new Date().getTime() - (FIVE_MINUTES_MILLIS - THREE_SECONDS_MILLIS); + const body = { + query: { term: { "managed_index.index": index } }, + script: { + lang: "painless", + source: `ctx._source['managed_index']['schedule']['interval']['start_time'] = ${startTime}L`, + }, + }; + cy.request("POST", `${Cypress.env("openSearchUrl")}/${IM_CONFIG_INDEX.OPENDISTRO_ISM_CONFIG}/_update_by_query`, body); + }); +}); + +Cypress.Commands.add("createRollup", (rollupId, rollupJSON) => { + cy.request("PUT", `${Cypress.env("openSearchUrl")}${IM_API.ROLLUP_JOBS_BASE}/${rollupId}`, rollupJSON); +}); + +Cypress.Commands.add("deleteTemplate", (name) => { + cy.request({ + url: `${Cypress.env("openSearchUrl")}${IM_API.INDEX_TEMPLATE_BASE}/${name}`, + failOnStatusCode: false, + method: "DELETE", + }); +}); + +Cypress.Commands.add("createTransform", (transformId, transformJSON) => { + cy.request("PUT", `${Cypress.env("openSearchUrl")}${IM_API.TRANSFORM_JOBS_BASE}/${transformId}`, transformJSON); +}); + +Cypress.Commands.add("createPipeline", (pipelineId, pipelineJSON) => { + cy.request("PUT", `${Cypress.env("openSearchUrl")}/_ingest/pipeline/${pipelineId}`, pipelineJSON); +}); + +Cypress.Commands.add("disableJitter", () => { + // Sets the jitter to 0 in the ISM plugin cluster settings + const jitterJson = { + persistent: { + plugins: { + index_state_management: { + jitter: "0.0", + }, + }, + }, + }; + cy.request("PUT", `${Cypress.env("openSearchUrl")}/_cluster/settings`, jitterJson); +}); + +Cypress.Commands.add("addIndexAlias", (alias, index) => { + cy.request({ + url: `${Cypress.env("openSearchUrl")}/_aliases`, + method: "POST", + body: { + actions: [ + { + add: { + index, + alias, + }, + }, + ], + }, + failOnStatusCode: false, + }); +}); + +Cypress.Commands.add("removeIndexAlias", (alias) => { + cy.request({ + url: `${Cypress.env("openSearchUrl")}/_aliases`, + method: "POST", + body: { + actions: [ + { + remove: { + index: "*", + alias, + }, + }, + ], + }, + failOnStatusCode: false, + }); +}); diff --git a/cypress/utils/plugins/index-management-dashboards-plugin/constants.js b/cypress/utils/plugins/index-management-dashboards-plugin/constants.js new file mode 100644 index 000000000..0218739e5 --- /dev/null +++ b/cypress/utils/plugins/index-management-dashboards-plugin/constants.js @@ -0,0 +1,24 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export const IM_API_ROUTE_PREFIX = "/_plugins/_ism"; +export const IM_API_ROUTE_PREFIX_ROLLUP = "/_plugins/_rollup"; +export const IM_API_ROUTE_PREFIX_TRANSFORM = "/_plugins/_transform"; +export const IM_CONFIG_INDEX = { + OPENDISTRO_ISM_CONFIG: ".opendistro-ism-config", +}; +export const IM_API = { + INDEX_TEMPLATE_BASE: "/_index_template", + DATA_STREAM_BASE: "/_data_stream", + POLICY_BASE: `${IM_API_ROUTE_PREFIX}/policies`, + EXPLAIN_BASE: `${IM_API_ROUTE_PREFIX}/explain`, + RETRY_BASE: `${IM_API_ROUTE_PREFIX}/retry`, + ADD_POLICY_BASE: `${IM_API_ROUTE_PREFIX}/add`, + REMOVE_POLICY_BASE: `${IM_API_ROUTE_PREFIX}/remove`, + CHANGE_POLICY_BASE: `${IM_API_ROUTE_PREFIX}/change_policy`, + ROLLUP_JOBS_BASE: `${IM_API_ROUTE_PREFIX_ROLLUP}/jobs`, + TRANSFORM_JOBS_BASE: `${IM_API_ROUTE_PREFIX_TRANSFORM}`, +}; +export const IM_PLUGIN_NAME = "opensearch_index_management_dashboards";