Skip to content

Commit

Permalink
update integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Nov 9, 2022
1 parent 8cee923 commit 3e69ff3
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions cypress/integration/indices_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,42 +215,33 @@ describe("Indices", () => {
const reindexedIndex = "reindex_opensearch_dashboards_sample_data_ecommerce";
const splittedIndex = "split_opensearch_dashboards_sample_data_logs";
before(() => {
cy.deleteAllIndices();
// 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 });

cy.request({
method: "PUT",
url: `${Cypress.env("opensearch")}/opensearch_dashboards_sample_data_logs/_settings`,
body: {
"index.blocks.read_only": false,
method: "POST",
url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/ecommerce`,
headers: {
"osd-xsrf": true,
},
failOnStatusCode: false,
}).then((response) => {
expect(response.status).equal(200);
});

cy.window().then((window) => {
const fetchMethod = (url, method) =>
window.fetch(url, {
method,
headers: {
"osd-version": "2.4.0",
},
});
return Promise.all([
fetchMethod("/api/sample_data/ecommerce", "DELETE").then(() => fetchMethod("/api/sample_data/ecommerce", "POST")),
fetchMethod("/api/sample_data/logs", "DELETE").then(() => fetchMethod("/api/sample_data/logs", "POST")),
]);
});
cy.request({
method: "PUT",
url: `${Cypress.env("opensearch")}/${splittedIndex}/_settings`,
body: {
"index.blocks.read_only": false,
method: "POST",
url: `${Cypress.env("opensearch_dashboards")}/api/sample_data/logs`,
headers: {
"osd-xsrf": true,
},
failOnStatusCode: false,
}).then((response) => {
expect(response.status).equal(200);
});

cy.request({
method: "DELETE",
url: `${Cypress.env("opensearch")}/${reindexedIndex}`,
Expand Down Expand Up @@ -299,7 +290,6 @@ describe("Indices", () => {
window.fetch(`/api/ism/apiCaller`, {
headers: {
"content-type": "application/json",
"osd-version": "2.4.0",
},
body: JSON.stringify({
endpoint: "indices.split",
Expand Down

0 comments on commit 3e69ff3

Please sign in to comment.