Skip to content

Commit

Permalink
Merge branch 'main' into #938_server_starts_before_cypress_test
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenlan-amzn authored Jan 9, 2024
2 parents 67a59a5 + be76a29 commit 781d4a8
Show file tree
Hide file tree
Showing 39 changed files with 123 additions and 164 deletions.
4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module.exports = function (api) {
presets: [require("@babel/preset-env"), require("@babel/preset-react"), require("@babel/preset-typescript")],
plugins: [
[require("@babel/plugin-transform-runtime"), { regenerator: true }],
require("@babel/plugin-proposal-class-properties"),
require("@babel/plugin-proposal-object-rest-spread"),
require("@babel/plugin-transform-class-properties"),
require("@babel/plugin-transform-object-rest-spread"),
[require("@babel/plugin-transform-modules-commonjs"), { allowTopLevelThis: true }],
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,32 @@ describe("Aliases", () => {
});

beforeEach(() => {
// Intercept the specific POST request
cy.intercept("POST", "/api/ism/apiCaller", (req) => {
if (req.body.data && req.body.data.name === "**" && req.body.data.s === "alias:desc" && req.body.endpoint === "cat.aliases") {
req.alias = "apiCaller"; // Assign an alias directly if the condition is met
}
});

// Visit ISM OSD
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 });
// Wait for 120 seconds for OSD to start.
// eslint-disable-next-line cypress/no-unnecessary-waiting
// cy.wait(120000);

const startTime = new Date().getTime();

// Wait for the API call to complete
cy.wait("@apiCaller", { timeout: 240000 }).then(() => {
// Log the calculated duration
const endTime = new Date().getTime();
const duration = endTime - startTime; // Duration in milliseconds
cy.log(`@apiCaller completed in ${duration} milliseconds`);
});

// Common text to wait for to confirm page loaded, give up to 120 seconds for initial load
cy.contains("Rows per page", { timeout: 120000 }).should("be.visible");
});

describe("can be searched / sorted / paginated", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import samplePolicy from "../../../fixtures/plugins/index-management-dashboards-
const POLICY_ID = "test_policy_id";
const SAMPLE_INDEX = "sample_index";

describe("Indices", () => {
describe("Indexes", () => {
beforeEach(() => {
// Set welcome screen tracking to false
localStorage.setItem("home:welcome:show", "false");
Expand Down Expand Up @@ -52,7 +52,7 @@ describe("Indices", () => {
});
});

describe("can show data stream indices", () => {
describe("can show data stream indexes", () => {
before(() => {
cy.deleteAllIndices();
cy.deleteIMJobs();
Expand Down Expand Up @@ -169,7 +169,7 @@ describe("Indices", () => {
});
});

describe("can make indices deleted", () => {
describe("can make indexes deleted", () => {
before(() => {
cy.deleteAllIndices();
cy.deleteIMJobs();
Expand Down Expand Up @@ -417,7 +417,7 @@ describe("Indices", () => {
cy.get('[data-test-subj="Close Action"]').should("exist").should("not.have.class", "euiContextMenuItem-isDisabled").click();

// Check for close index modal
cy.contains("Close indices");
cy.contains("Close indexes");

// Close confirm button should be disabled
cy.get('[data-test-subj="Close Confirm button"]').should("have.class", "euiButton-isDisabled");
Expand Down Expand Up @@ -457,7 +457,7 @@ describe("Indices", () => {
cy.get('[data-test-subj="Open Action"]').should("exist").should("not.have.class", "euiContextMenuItem-isDisabled").click();

// Check for open index modal
cy.contains("Open indices");
cy.contains("Open indexes");

cy.get('[data-test-subj="Open Confirm button"]').click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const POLICY_ID_ROLLOVER = "test_policy_rollover";
const SAMPLE_INDEX = "sample_index";
const SAMPLE_INDEX_ROLLOVER = "sample_index-01";

describe("Managed indices", () => {
describe("Managed indexes", () => {
beforeEach(() => {
// Set welcome screen tracking to false
localStorage.setItem("home:welcome:show", "false");
Expand Down Expand Up @@ -58,13 +58,13 @@ describe("Managed indices", () => {
});

// Confirm we got a remove policy toaster
cy.contains("Removed policy from 1 managed indices");
cy.contains("Removed policy from 1 managed indexes");

// Wait some time for remove policy to execute before reload
cy.wait(3000).reload();

// Confirm we are back to empty loading state, give 20 seconds as OSD takes a while to load
cy.contains("There are no existing managed indices.", { timeout: 20000 });
cy.contains("There are no existing managed indexes.", { timeout: 20000 });
});
});

Expand Down Expand Up @@ -121,7 +121,7 @@ describe("Managed indices", () => {
cy.get(`[data-test-subj="retryModalRetryButton"]`).click({ force: true });

// Confirm we got retry toaster
cy.contains("Retried 1 managed indices");
cy.contains("Retried 1 managed indexes");

// Reload the page
cy.reload();
Expand Down Expand Up @@ -238,10 +238,10 @@ describe("Managed indices", () => {
});

// Confirm we got the change policy toaster
cy.contains("Changed policy on 1 indices");
cy.contains("Changed policy on 1 indexes");

// Click back to Managed Indices page by clicking "Managed indices" breadcrumb
cy.contains("Policy managed indices").click();
cy.contains("Policy managed indexes").click();

// Speed up execution of managed index
cy.updateManagedIndexConfigStartTime(SAMPLE_INDEX);
Expand All @@ -257,7 +257,7 @@ describe("Managed indices", () => {
});
});

describe("can manage data stream indices", () => {
describe("can manage data stream indexes", () => {
before(() => {
cy.deleteAllIndices();
cy.deleteIMJobs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ describe("Rollups", () => {
cy.get("button").contains("Next").click({ force: true });

// Confirm that we got to step 4 of creation page
cy.contains("Job name and indices");
cy.contains("Job name and indexes");

// Click the create button
cy.get("button").contains("Create").click({ force: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe("Snapshots", () => {
});

describe("Snapshot can be restored", () => {
it("Successfully restores indices from snapshot", () => {
it("Successfully restores indexes from snapshot", () => {
// Must wait here before refreshing so snapshot status becomes 'success'
cy.wait(5000);

Expand Down
4 changes: 2 additions & 2 deletions cypress/utils/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ Cypress.Commands.add("login", () => {
});

Cypress.Commands.add("deleteAllIndices", () => {
cy.log("Deleting all indices");
cy.log("Deleting all indexes");
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.log("Deleting AD system indexes");
cy.request("DELETE", `${Cypress.env("openSearchUrl")}/.opendistro-anomaly*`);
});

Expand Down
77 changes: 0 additions & 77 deletions integtest.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class ChangePolicy extends Component<ChangePolicyProps, ChangePol
if (changePolicyResponse.ok) {
const { updatedIndices, failedIndices, failures } = changePolicyResponse.response;
if (updatedIndices) {
this.context.notifications.toasts.addSuccess(`Changed policy on ${updatedIndices} indices`);
this.context.notifications.toasts.addSuccess(`Changed policy on ${updatedIndices} indexes`);
}
if (failures) {
this.context.notifications.toasts.addDanger(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function BackingIndices(props: SubDetailProps) {
{
field: "managed",
name: "Managed by policy",
sortable: false,
sortable: true,
truncateText: true,
textOnly: true,
render: renderNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class JobNameAndIndices extends Component<JobNameAndIndicesProps>
</ModalConsumer>
}
bodyStyles={{ padding: "initial" }}
title="Job name and indices"
title="Job name and indexes"
titleSize="m"
>
<div style={{ padding: "15px" }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ describe("<CreateRollupForm /> creation", () => {
userEvent.click(getByTestId("createRollupNextButton"));

//Check that it routes to step 4
expect(queryByText("Job name and indices")).not.toBeNull();
expect(queryByText("Job name and indexes")).not.toBeNull();

//Test create
userEvent.click(getByTestId("createRollupSubmitButton"));
Expand Down Expand Up @@ -430,6 +430,6 @@ describe("<CreateRollupForm /> creation", () => {

//Check that it routes to step 4
userEvent.click(getByTestId("createRollupNextButton"));
expect(queryByText("Job name and indices")).not.toBeNull();
expect(queryByText("Job name and indexes")).not.toBeNull();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function CloseIndexModal(props: CloseIndexModalProps) {
return (
<EuiModal onClose={onClose}>
<EuiModalHeader>
<EuiModalHeaderTitle>Close indices</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Close indexes</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ HTMLCollection [
<div
class="euiModalHeader__title"
>
Close indices
Close indexes
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function DeleteIndexModal(props: DeleteIndexModalProps) {
return (
<EuiModal onClose={onClose}>
<EuiModalHeader>
<EuiModalHeaderTitle>Delete indices</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Delete indexes</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ HTMLCollection [
<div
class="euiModalHeader__title"
>
Delete indices
Delete indexes
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class IndexControls extends Component<IndexControlsProps, IndexCo
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiSwitch
label="Show data stream indices"
label="Show data stream indexes"
checked={showDataStreams}
onChange={toggleShowDataStreams}
data-test-subj="toggleShowDataStreams"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ exports[`<IndexControls /> spec renders data streams selection field 1`] = `
class="euiSwitch__label"
id="some_html_id"
>
Show data stream indices
Show data stream indexes
</span>
</div>
</div>
Expand Down Expand Up @@ -215,7 +215,7 @@ exports[`<IndexControls /> spec renders the component 1`] = `
class="euiSwitch__label"
id="some_html_id"
>
Show data stream indices
Show data stream indexes
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function OpenIndexModal(props: OpenIndexModalProps) {
return (
<EuiModal onClose={onClose}>
<EuiModalHeader>
<EuiModalHeaderTitle>Open indices</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Open indexes</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ HTMLCollection [
<div
class="euiModalHeader__title"
>
Open indices
Open indexes
</div>
</div>
<div
Expand Down
2 changes: 1 addition & 1 deletion public/pages/Indices/containers/Indices/Indices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export default class Indices extends Component<IndicesProps, IndicesState> {
/>
}
bodyStyles={{ padding: "initial" }}
title="Indices"
title="Indexes"
itemCount={totalIndices}
>
<IndexControls
Expand Down
Loading

0 comments on commit 781d4a8

Please sign in to comment.