-const asyncErrorPool = new FixedClusterPool(
- 1,
- './tests/worker/cluster/asyncErrorWorker.js',
- {
- onlineHandler: () => console.log('worker is online')
- }
-)
-const asyncPool = new FixedClusterPool(
- 1,
- './tests/worker/cluster/asyncWorker.js',
- {
- maxTasks: maxTasks
- }
-)
-
-describe('Fixed cluster pool test suite ', () => {
- it('Choose worker round robin test', async () => {
- const results = new Set()
- for (let i = 0; i < numberOfWorkers; i++) {
- results.add(pool.chooseWorker().id)
+describe('Fixed cluster pool test suite', () => {
+ const numberOfWorkers = 6
+ const pool = new FixedClusterPool(
+ numberOfWorkers,
+ './tests/worker-files/cluster/testWorker.js',
+ {
+ errorHandler: e => console.error(e)
+ }
+ )
+ const emptyPool = new FixedClusterPool(
+ numberOfWorkers,
+ './tests/worker-files/cluster/emptyWorker.js',
+ { exitHandler: () => console.log('empty pool worker exited') }
+ )
+ const echoPool = new FixedClusterPool(
+ numberOfWorkers,
+ './tests/worker-files/cluster/echoWorker.js'
+ )
+ const errorPool = new FixedClusterPool(
+ numberOfWorkers,
+ './tests/worker-files/cluster/errorWorker.js',
+ {
+ errorHandler: e => console.error(e)
+ }
+ )
+ const asyncErrorPool = new FixedClusterPool(
+ numberOfWorkers,
+ './tests/worker-files/cluster/asyncErrorWorker.js',
+ {
+ errorHandler: e => console.error(e)