-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: rollover (opensearch-project#607)
* feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: add write index in aliases Signed-off-by: suzhou <[email protected]> * feat: remove conditions section Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: merge data streams Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: add rollover cypress test Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: make cypress run Signed-off-by: suzhou <[email protected]> * feat cypress optimize Signed-off-by: suzhou <[email protected]> * fix: rollover with mappings Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: make rollover works in index form Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: add placeholder Signed-off-by: suzhou <[email protected]> * feat: alignment Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update rollover description Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update snapshot Signed-off-by: suzhou <[email protected]> * feat: make cypress and unit test run Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> * feat: update Signed-off-by: suzhou <[email protected]> --------- Signed-off-by: suzhou <[email protected]> (cherry picked from commit 497d5f1)
- Loading branch information
1 parent
24bd906
commit c514ed6
Showing
94 changed files
with
5,583 additions
and
163 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { PLUGIN_NAME } from "../support/constants"; | ||
|
||
describe("Data stream", () => { | ||
before(() => { | ||
// Set welcome screen tracking to false | ||
localStorage.setItem("home:welcome:show", "false"); | ||
cy.deleteTemplate("index-common-template"); | ||
cy.createIndexTemplate("index-common-template", { | ||
index_patterns: ["ds-*"], | ||
data_stream: {}, | ||
template: { | ||
aliases: { | ||
alias_for_common_1: {}, | ||
alias_for_common_2: {}, | ||
}, | ||
settings: { | ||
number_of_shards: 2, | ||
number_of_replicas: 1, | ||
}, | ||
}, | ||
}); | ||
cy.request({ | ||
url: `${Cypress.env("opensearch")}/_data_stream/*`, | ||
method: "DELETE", | ||
failOnStatusCode: false, | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
// Visit ISM OSD | ||
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${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 }); | ||
}); | ||
|
||
describe("can create a data stream", () => { | ||
it("successfully", () => { | ||
cy.get('[data-test-subj="Create data streamButton"]').click(); | ||
cy.get('[data-test-subj="form-row-name"]').type(`ds-{enter}`); | ||
cy.get('[data-test-subj="CreateDataStreamCreateButton"]').click(); | ||
cy.contains("ds- has been successfully created."); | ||
}); | ||
}); | ||
|
||
describe("can be searched / sorted / paginated", () => { | ||
it("successfully", () => { | ||
cy.contains("ds-"); | ||
cy.contains("index-common-template"); | ||
}); | ||
}); | ||
|
||
describe("can delete a data stream", () => { | ||
it("successfully", () => { | ||
cy.get('[data-test-subj="moreAction"] button') | ||
.click() | ||
.get('[data-test-subj="deleteAction"]') | ||
.should("be.disabled") | ||
.get(`#_selection_column_ds--checkbox`) | ||
.click() | ||
.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_ds--checkbox`).should("not.exist"); | ||
}); | ||
}); | ||
|
||
after(() => { | ||
cy.request({ | ||
url: `${Cypress.env("opensearch")}/_data_stream`, | ||
method: "DELETE", | ||
failOnStatusCode: false, | ||
}); | ||
cy.deleteTemplate("index-common-template"); | ||
}); | ||
}); |
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,100 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { PLUGIN_NAME } from "../support/constants"; | ||
|
||
const rolloverValidAlias = "rollover-valid-alias"; | ||
const rolloverAliasNeedTargetIndex = "rollover-alias-need-target-index"; | ||
const rolloverDataStream = "data-stream-rollover"; | ||
const validIndex = "index-000001"; | ||
const invalidIndex = "index-test-rollover"; | ||
|
||
describe("Rollover", () => { | ||
before(() => { | ||
// Set welcome screen tracking to false | ||
localStorage.setItem("home:welcome:show", "false"); | ||
cy.deleteTemplate("index-common-template"); | ||
cy.deleteAllIndices(); | ||
cy.request({ | ||
url: `${Cypress.env("opensearch")}/_data_stream/*`, | ||
method: "DELETE", | ||
failOnStatusCode: false, | ||
}); | ||
cy.createIndex(validIndex); | ||
cy.createIndex(invalidIndex); | ||
cy.addAlias(rolloverValidAlias, validIndex); | ||
cy.addAlias(rolloverAliasNeedTargetIndex, invalidIndex); | ||
cy.createIndexTemplate("index-common-template", { | ||
index_patterns: ["data-stream-*"], | ||
data_stream: {}, | ||
template: { | ||
aliases: { | ||
alias_for_common_1: {}, | ||
alias_for_common_2: {}, | ||
}, | ||
settings: { | ||
number_of_shards: 2, | ||
number_of_replicas: 1, | ||
}, | ||
}, | ||
}); | ||
cy.request({ | ||
url: `${Cypress.env("opensearch")}/_data_stream/${rolloverDataStream}`, | ||
method: "PUT", | ||
failOnStatusCode: false, | ||
}); | ||
}); | ||
|
||
describe("rollover", () => { | ||
it("rollover data stream successfully", () => { | ||
// Visit ISM OSD | ||
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/rollover/${rolloverDataStream}`); | ||
cy.contains("Configure source", { timeout: 60000 }); | ||
|
||
// click create | ||
cy.get('[data-test-subj="rolloverSubmitButton"]').click({ force: true }); | ||
|
||
cy.contains(/has been successfully rollover./); | ||
}); | ||
|
||
it("rollover valid alias successfully", () => { | ||
// Visit ISM OSD | ||
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/rollover/${rolloverValidAlias}`); | ||
cy.contains("Configure new rollover index", { timeout: 60000 }); | ||
|
||
// click create | ||
cy.get('[data-test-subj="rolloverSubmitButton"]').click({ force: true }); | ||
|
||
cy.contains(/has been successfully rollover./); | ||
}); | ||
|
||
it("rollover invalid alias successfully", () => { | ||
// Visit ISM OSD | ||
cy.visit(`${Cypress.env("opensearch_dashboards")}/app/${PLUGIN_NAME}#/rollover/${rolloverAliasNeedTargetIndex}`); | ||
cy.contains("Configure new rollover index", { timeout: 60000 }); | ||
|
||
// click create | ||
cy.get('[data-test-subj="rolloverSubmitButton"]').click({ force: true }); | ||
|
||
cy.contains("Invalid index name."); | ||
|
||
cy.get('[data-test-subj="form-name-index"] input').type("index-test-rollover-target"); | ||
|
||
// click create | ||
cy.get('[data-test-subj="rolloverSubmitButton"]').click({ force: true }); | ||
|
||
cy.contains(/has been successfully rollover./); | ||
}); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteTemplate("index-common-template"); | ||
cy.deleteAllIndices(); | ||
cy.request({ | ||
url: `${Cypress.env("opensearch")}/_data_stream/*`, | ||
method: "DELETE", | ||
failOnStatusCode: false, | ||
}); | ||
}); | ||
}); |
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
Oops, something went wrong.