Skip to content

Commit 930f154

Browse files
committed
Fix Integ tests
Signed-off-by: Vaibhav Agarwal <vaibhoag@amazon.com>
1 parent 78e28a8 commit 930f154

5 files changed

Lines changed: 43 additions & 3 deletions

File tree

.github/actions/run-cypress-tests/action.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ runs:
131131
command: yarn run cypress run --config-file cypress.config.js
132132
wait-on: 'http://localhost:5601'
133133
browser: chrome
134+
env:
135+
NODE_OPTIONS: '--expose-gc'
134136
- name: Cypress tests
135137
uses: cypress-io/github-action@v5
136138
if: ${{ inputs.with-security == 'true' }}
@@ -139,6 +141,8 @@ runs:
139141
command: yarn run cypress run --config-file cypress.config.js --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=500
140142
wait-on: 'http://localhost:5601'
141143
browser: chrome
144+
env:
145+
NODE_OPTIONS: '--expose-gc'
142146
# Screenshots are only captured on failure, will change this once we do visual regression tests
143147
- uses: actions/upload-artifact@v4
144148
if: failure()

.github/workflows/cypress-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
- "*"
99
env:
1010
OPENSEARCH_DASHBOARDS_VERSION: 'main'
11-
CYPRESS_MEMORY_LIMIT: '40960'
12-
NODE_OPTIONS: '--max-old-space-size=40960'
11+
CYPRESS_MEMORY_LIMIT: '65536' # Increase to 64GB
12+
NODE_OPTIONS: '--max-old-space-size=65536'
1313
jobs:
1414
tests:
1515
name: Run Cypress E2E tests

cypress/e2e/plugins/index-management-dashboards-plugin/split_index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,28 @@ describe("Split Index", () => {
1616
cy.wait(6000);
1717
});
1818

19+
after(() => {
20+
if (global.gc) global.gc();
21+
});
22+
1923
describe("can be created and updated", () => {
2024
beforeEach(() => {
2125
// Visit ISM OSD
2226
cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`);
2327
cy.contains("Rows per page", { timeout: 60000 });
2428
});
2529

30+
afterEach(() => {
31+
// Force garbage collection after each test
32+
if (global.gc) global.gc();
33+
// Clear any Monaco editor instances
34+
cy.window().then((win) => {
35+
if (win.monaco && win.monaco.editor) {
36+
win.monaco.editor.getModels().forEach((model) => model.dispose());
37+
}
38+
});
39+
});
40+
2641
let splitNumber = 2;
2742
let replicaNumber = 1;
2843
it("Create an index successfully", () => {
@@ -110,12 +125,18 @@ describe("Split Index", () => {
110125
.get('[aria-controls="accordionForCreateIndexSettings"]')
111126
.click()
112127
.end()
128+
.get('[data-test-subj="codeEditorContainer"]')
129+
.should("be.visible")
130+
.wait(1000)
113131
.get('[data-test-subj="codeEditorContainer"] textarea')
114132
.focus()
133+
.wait(500)
115134
// Need to remove the default {} in advanced setting
116135
.clear()
136+
.wait(500)
117137
.type(`{"index.number_of_shards": "${splitNumber}", "index.number_of_replicas": "${replicaNumber}"}`, {
118138
parseSpecialCharSequences: false,
139+
delay: 50,
119140
})
120141
.end()
121142
.get('[data-test-subj="splitButton"]', { timeout: 10000 })

public/components/MonacoJSONEditor/MonacoJSONEditor.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ const MonacoJSONEditor = forwardRef(
7474
useEffect(() => {
7575
return () => {
7676
onClickOutsideHandler.current();
77+
// Cleanup Monaco editor to prevent memory leaks
78+
if (editorRef.current) {
79+
editorRef.current.dispose();
80+
}
7781
};
7882
}, []);
7983

@@ -127,6 +131,17 @@ const MonacoJSONEditor = forwardRef(
127131
editorDidMount={(editor) => {
128132
editorRef.current = editor;
129133
setIsReady(true);
134+
// Add memory management for large JSON files
135+
editor.updateOptions({
136+
wordWrap: "on",
137+
minimap: { enabled: false },
138+
scrollBeyondLastLine: false,
139+
renderLineHighlight: "none",
140+
occurrencesHighlight: false,
141+
selectionHighlight: false,
142+
overviewRulerBorder: false,
143+
hideCursorInOverviewRuler: true,
144+
});
130145
}}
131146
/>
132147
</div>

public/components/SwitchableEditor/SwitchableEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const SwitchableEditor = forwardRef(
4646
) : null}
4747
{checked ? (
4848
diagnosticsOptions ? (
49-
<MonacoJSONEditor path={path} {...others} ref={ref} />
49+
<MonacoJSONEditor path={path} {...others} ref={editorRef} />
5050
) : (
5151
<JSONDiffEditor {...others} ref={editorRef} />
5252
)

0 commit comments

Comments
 (0)