Skip to content

Commit 115a036

Browse files
committed
test: limit young generation in heap snapshot tests
Set maxYoungGenerationSizeMb for the worker heap snapshot tests so the temporary heap limit used while writing the snapshot is deterministic. This keeps the tests focused on verifying that one snapshot is written before the worker reports ERR_WORKER_OUT_OF_MEMORY. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
1 parent 9f23e70 commit 115a036

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

test/fixtures/workload/grow-worker-and-set-near-heap-limit.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ new Worker(path.join(__dirname, 'grow-and-set-near-heap-limit.js'), {
99
},
1010
resourceLimits: {
1111
maxOldGenerationSizeMb:
12-
parseInt(process.env.TEST_OLD_SPACE_SIZE) || 20
13-
}
12+
parseInt(process.env.TEST_OLD_SPACE_SIZE) || 20,
13+
...(process.env.TEST_YOUNG_SPACE_SIZE !== undefined && {
14+
maxYoungGenerationSizeMb: parseInt(process.env.TEST_YOUNG_SPACE_SIZE),
15+
}),
16+
},
1417
});
1518

test/fixtures/workload/grow-worker.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ new Worker(path.join(__dirname, 'grow.js'), {
99
],
1010
resourceLimits: {
1111
maxOldGenerationSizeMb:
12-
parseInt(process.env.TEST_OLD_SPACE_SIZE) || 20
13-
}
12+
parseInt(process.env.TEST_OLD_SPACE_SIZE) || 20,
13+
...(process.env.TEST_YOUNG_SPACE_SIZE !== undefined && {
14+
maxYoungGenerationSizeMb: parseInt(process.env.TEST_YOUNG_SPACE_SIZE),
15+
}),
16+
},
1417
});

test/parallel/test-heapsnapshot-near-heap-limit-by-api-in-worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const env = {
2222
env: {
2323
TEST_SNAPSHOTS: 1,
2424
TEST_OLD_SPACE_SIZE: 50,
25+
TEST_YOUNG_SPACE_SIZE: 16,
2526
...env
2627
}
2728
});

test/parallel/test-heapsnapshot-near-heap-limit-worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const env = {
2020
env: {
2121
TEST_SNAPSHOTS: 1,
2222
TEST_OLD_SPACE_SIZE: 50,
23+
TEST_YOUNG_SPACE_SIZE: 16,
2324
...env
2425
}
2526
});

0 commit comments

Comments
 (0)