-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Reindex operation Signed-off-by: Hailong Cui <[email protected]> * update integration test Signed-off-by: Hailong Cui <[email protected]> * feat: update unit test for shrink Signed-off-by: suzhou <[email protected]> * update integ test Signed-off-by: Hailong Cui <[email protected]> * update integ test Signed-off-by: Hailong Cui <[email protected]> * add more UT Signed-off-by: Hailong Cui <[email protected]> * refactor on reindex flyout Signed-off-by: Hailong Cui <[email protected]> * fix reindex integration case Signed-off-by: Hailong Cui <[email protected]> * fix UT Signed-off-by: Hailong Cui <[email protected]> * change reindex from flyout to page Signed-off-by: Hailong Cui <[email protected]> * add integration test for reindex page Signed-off-by: Hailong Cui <[email protected]> * add UT for reindex Signed-off-by: Hailong Cui <[email protected]> * create index flyout Signed-off-by: Hailong Cui <[email protected]> * Refractor: Implement fields & validation (#384) * Refractor: Implement fields & validation Signed-off-by: suzhou <[email protected]> * feat: update unit test Signed-off-by: suzhou <[email protected]> * Feature: bump opensearch version to 2.5.0 Signed-off-by: suzhou <[email protected]> * Feature: update other version Signed-off-by: suzhou <[email protected]> * feat: use 2.4 version to run e2e test Signed-off-by: suzhou <[email protected]> * feat: add wait Signed-off-by: suzhou <[email protected]> * feat: update E2E test Signed-off-by: suzhou <[email protected]> Signed-off-by: suzhou <[email protected]> * feat: modify ref pointer Signed-off-by: suzhou <[email protected]> * feat: update reIndex Signed-off-by: suzhou <[email protected]> * create index flyout Signed-off-by: Hailong Cui <[email protected]> * add UT for reindex action Signed-off-by: Hailong Cui <[email protected]> * feat: enable import settings & mappings Signed-off-by: suzhou <[email protected]> * feat: update unit test Signed-off-by: suzhou <[email protected]> * feat: update reIndex Signed-off-by: suzhou <[email protected]> * feat: enable import settings & mappings Signed-off-by: suzhou <[email protected]> * feat: update unit test Signed-off-by: suzhou <[email protected]> * expand aliases and data streams for import mapping and settings Signed-off-by: Hailong Cui <[email protected]> * feat: update ref problem Signed-off-by: suzhou <[email protected]> * rename button name to Reindex Signed-off-by: Hailong Cui <[email protected]> * fix integration test Signed-off-by: Hailong Cui <[email protected]> * fix auto populate source index from search query Signed-off-by: Hailong Cui <[email protected]> * feat: add unit test & optimize interface Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update e2e test Signed-off-by: suzhou <[email protected]> * remove duplicate class ReindexRequest/ReindexResponse Signed-off-by: Hailong Cui <[email protected]> Signed-off-by: Hailong Cui <[email protected]> Signed-off-by: suzhou <[email protected]> Co-authored-by: suzhou <[email protected]>
- Loading branch information
1 parent
7560eb0
commit 8c61ffb
Showing
50 changed files
with
3,892 additions
and
1,829 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { PLUGIN_NAME } from "../support/constants"; | ||
const REINDEX_DEST = "test-ecomm-rdx"; | ||
const REINDEX_DEST_NO_SOURCE = "test-reindex-nosource"; | ||
|
||
describe("Reindex", () => { | ||
beforeEach(() => { | ||
// Set welcome screen tracking to false | ||
localStorage.setItem("home:welcome:show", "false"); | ||
|
||
// Visit ISM OSD | ||
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${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 }); | ||
}); | ||
|
||
describe("Reindex validation error", () => { | ||
before(() => { | ||
cy.deleteAllIndices(); | ||
// Load ecommerce data | ||
cy.request({ | ||
method: "POST", | ||
url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/ecommerce`, | ||
headers: { | ||
"osd-xsrf": true, | ||
}, | ||
}).then((response) => { | ||
expect(response.status).equal(200); | ||
}); | ||
|
||
cy.createIndex(REINDEX_DEST_NO_SOURCE, null, { | ||
mappings: { | ||
_source: { | ||
enabled: false, | ||
}, | ||
properties: { | ||
name: { | ||
type: "keyword", | ||
}, | ||
}, | ||
}, | ||
}); | ||
}); | ||
|
||
it("source validation failed", () => { | ||
// Confirm we have our initial index | ||
cy.contains(REINDEX_DEST_NO_SOURCE); | ||
|
||
cy.get(`[data-test-subj="checkboxSelectRow-${REINDEX_DEST_NO_SOURCE}"]`).check({ force: true }); | ||
|
||
// Click actions button | ||
cy.get('[data-test-subj="More Action"]').click(); | ||
// Reindex should show as activate | ||
cy.get('[data-test-subj="Reindex Action"]').should("exist").should("not.have.class", "euiContextMenuItem-isDisabled").click(); | ||
|
||
cy.contains(/_sources is not enabled/); | ||
}); | ||
}); | ||
|
||
describe("Reindex successfully", () => { | ||
before(() => { | ||
cy.deleteAllIndices(); | ||
// Load ecommerce data | ||
cy.request({ | ||
method: "POST", | ||
url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/ecommerce`, | ||
headers: { | ||
"osd-xsrf": true, | ||
}, | ||
}).then((response) => { | ||
expect(response.status).equal(200); | ||
}); | ||
|
||
cy.createIndex(REINDEX_DEST, null, { settings: { "index.number_of_replicas": 0 } }); | ||
|
||
cy.createPipeline("bumpOrderId", { | ||
description: "sample description", | ||
processors: [ | ||
{ | ||
set: { | ||
field: "order_id", | ||
value: "200{{order_id}}", | ||
}, | ||
}, | ||
], | ||
}); | ||
}); | ||
|
||
it("successfully", () => { | ||
// Confirm we have our initial index | ||
cy.contains("opensearch_dashboards_sample_data_ecommerce"); | ||
|
||
// Click actions button | ||
cy.get('[data-test-subj="More Action"]').click(); | ||
// Reindex should show as activate | ||
cy.get('[data-test-subj="Reindex Action"]').should("exist").should("not.have.class", "euiContextMenuItem-isDisabled").click(); | ||
|
||
cy.get(`div[data-test-subj="sourceSelector"]`) | ||
.find(`input[data-test-subj="comboBoxSearchInput"]`) | ||
.type(`opensearch_dashboards_sample_data_ecommerce{downArrow}{enter}`); | ||
|
||
cy.get(`div[data-test-subj="destinationSelector"]`) | ||
.find(`input[data-test-subj="comboBoxSearchInput"]`) | ||
.type(`${REINDEX_DEST}{downArrow}{enter}`); | ||
|
||
// open advance option | ||
cy.get('[data-test-subj="advanceOptionToggle"]').click(); | ||
|
||
// enable subset query | ||
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 }); | ||
|
||
// set slices to auto | ||
cy.get('[data-test-subj="slices"]').clear().type("auto"); | ||
|
||
// input pipeline | ||
cy.get(`div[data-test-subj="pipelineCombobox"]`).find(`input[data-test-subj="comboBoxSearchInput"]`).type("bumpOrderId{enter}"); | ||
|
||
// click to perform reindex | ||
cy.get('[data-test-subj="reindexConfirmButton"]').click(); | ||
cy.wait(10); | ||
cy.contains(/Reindex .* success .* taskId .*/); | ||
|
||
cy.wait(10000); | ||
// Type in REINDEX_DEST in search input | ||
cy.get(`input[type="search"]`).focus().type(REINDEX_DEST); | ||
|
||
// Confirm we only see REINDEX_DEST in table | ||
cy.get("tbody > tr").should(($tr) => { | ||
expect($tr, "1 row").to.have.length(1); | ||
expect($tr, "item").to.contain(REINDEX_DEST); | ||
// subset data number | ||
expect($tr, "item").to.contain(4213); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { waitFor } from "@testing-library/react"; | ||
import { act } from "react-dom/test-utils"; | ||
import { SimpleEuiToast } from "./index"; | ||
|
||
describe("SimpleEuiToast show", () => { | ||
it("render the component", async () => { | ||
await act(async () => { | ||
SimpleEuiToast.addSuccess("Success information"); | ||
}); | ||
expect(document.body).toMatchSnapshot(); | ||
expect(document.querySelector('[data-test-subj="toast_Success information"]')).not.toBeNull(); | ||
await act(async () => { | ||
SimpleEuiToast.addDanger("Error information"); | ||
}); | ||
expect(document.querySelector('[data-test-subj="toast_Error information"]')).not.toBeNull(); | ||
await act(async () => { | ||
SimpleEuiToast.show({ | ||
toastLifeTimeMs: 10, | ||
title: "Test quick destroy", | ||
}); | ||
}); | ||
await waitFor(() => { | ||
expect(document.querySelector('[data-test-subj="toast_Test quick destroy"]')).toBeNull(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.