-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rafal Augustyniak
committed
Dec 17, 2021
1 parent
b2d5552
commit 19e8725
Showing
8 changed files
with
158 additions
and
9 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
const test = require('ava'); | ||
|
||
const WorkerNodes = require('../'); | ||
const { fixture } = require('./utils'); | ||
|
||
test('should set maxYoungGenerationSizeMb', async t => { | ||
// given | ||
const workerNodes = new WorkerNodes(fixture('process-info'), { | ||
autoStart: true, | ||
maxWorkers: 2, | ||
minWorkers: 2, | ||
resourceLimits: { | ||
maxYoungGenerationSizeMb: 20 | ||
} | ||
}); | ||
|
||
// when | ||
await workerNodes.ready(); | ||
|
||
const workersList = workerNodes.getUsedWorkers(); | ||
|
||
// then | ||
workersList.forEach(worker => { | ||
if (!worker.resourceLimits) { | ||
// resourceLimits is unsupported before node 12, skipping | ||
return t.true(true); | ||
} | ||
|
||
t.true(worker.resourceLimits.maxYoungGenerationSizeMb === 20) | ||
}); | ||
}); | ||
|
||
test('should set maxOldGenerationSizeMb', async t => { | ||
// given | ||
const workerNodes = new WorkerNodes(fixture('process-info'), { | ||
autoStart: true, | ||
maxWorkers: 2, | ||
minWorkers: 2, | ||
resourceLimits: { | ||
maxOldGenerationSizeMb: 300 | ||
} | ||
}); | ||
|
||
// when | ||
await workerNodes.ready(); | ||
|
||
const workersList = workerNodes.getUsedWorkers(); | ||
|
||
// then | ||
workersList.forEach(worker => { | ||
if (!worker.resourceLimits) { | ||
// resourceLimits is unsupported before node 12, skipping | ||
return t.true(true); | ||
} | ||
|
||
t.true(worker.resourceLimits.maxOldGenerationSizeMb === 300) | ||
}); | ||
}); | ||
|
||
test('should set codeRangeSizeMb', async t => { | ||
// given | ||
const workerNodes = new WorkerNodes(fixture('process-info'), { | ||
autoStart: true, | ||
maxWorkers: 2, | ||
minWorkers: 2, | ||
resourceLimits: { | ||
codeRangeSizeMb: 1 | ||
} | ||
}); | ||
|
||
// when | ||
await workerNodes.ready(); | ||
|
||
const workersList = workerNodes.getUsedWorkers(); | ||
|
||
// then | ||
workersList.forEach(worker => { | ||
if (!worker.resourceLimits) { | ||
// resourceLimits is unsupported before node 12, skipping | ||
return t.true(true); | ||
} | ||
|
||
t.true(worker.resourceLimits.codeRangeSizeMb === 1) | ||
}); | ||
}); | ||
|
||
test('should set stackSizeMb', async t => { | ||
// given | ||
const workerNodes = new WorkerNodes(fixture('process-info'), { | ||
autoStart: true, | ||
maxWorkers: 2, | ||
minWorkers: 2, | ||
resourceLimits: { | ||
stackSizeMb: 8 | ||
} | ||
}); | ||
|
||
// when | ||
await workerNodes.ready(); | ||
|
||
const workersList = workerNodes.getUsedWorkers(); | ||
|
||
// then | ||
workersList.forEach(worker => { | ||
if (!worker.resourceLimits) { | ||
// resourceLimits is unsupported before node 12, skipping | ||
return t.true(true); | ||
} | ||
|
||
t.true(worker.resourceLimits.stackSizeMb === 8) | ||
}); | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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