diff options
Diffstat (limited to 'test/fixtures/workload')
-rw-r--r-- | test/fixtures/workload/bounded.js | 22 | ||||
-rw-r--r-- | test/fixtures/workload/grow-worker.js | 14 | ||||
-rw-r--r-- | test/fixtures/workload/grow.js | 12 |
3 files changed, 48 insertions, 0 deletions
diff --git a/test/fixtures/workload/bounded.js b/test/fixtures/workload/bounded.js new file mode 100644 index 00000000000..ddf288d034b --- /dev/null +++ b/test/fixtures/workload/bounded.js @@ -0,0 +1,22 @@ +'use strict'; + +const total = parseInt(process.env.TEST_ALLOCATION) || 5000; +const chunk = parseInt(process.env.TEST_CHUNK) || 1000; +const cleanInterval = parseInt(process.env.TEST_CLEAN_INTERVAL) || 100; +let count = 0; +let arr = []; +function runAllocation() { + count++; + if (count < total) { + if (count % cleanInterval === 0) { + arr.splice(0, arr.length); + setImmediate(runAllocation); + } else { + const str = JSON.stringify(process.config).slice(0, chunk); + arr.push(str); + setImmediate(runAllocation); + } + } +} + +setImmediate(runAllocation); diff --git a/test/fixtures/workload/grow-worker.js b/test/fixtures/workload/grow-worker.js new file mode 100644 index 00000000000..092d8f27751 --- /dev/null +++ b/test/fixtures/workload/grow-worker.js @@ -0,0 +1,14 @@ +'use strict'; + +const { Worker } = require('worker_threads'); +const path = require('path'); +const max_snapshots = parseInt(process.env.TEST_SNAPSHOTS) || 1; +new Worker(path.join(__dirname, 'grow.js'), { + execArgv: [ + `--heapsnapshot-near-heap-limit=${max_snapshots}`, + ], + resourceLimits: { + maxOldGenerationSizeMb: + parseInt(process.env.TEST_OLD_SPACE_SIZE) || 20 + } +}); diff --git a/test/fixtures/workload/grow.js b/test/fixtures/workload/grow.js new file mode 100644 index 00000000000..9ac0139b332 --- /dev/null +++ b/test/fixtures/workload/grow.js @@ -0,0 +1,12 @@ +'use strict'; + +const chunk = parseInt(process.env.TEST_CHUNK) || 1000; + +let arr = []; +function runAllocation() { + const str = JSON.stringify(process.config).slice(0, chunk); + arr.push(str); + setImmediate(runAllocation); +} + +setImmediate(runAllocation); |