X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fcluster%2Ffixed.test.js;h=a5eaa29ab5a4b1430066721decf5c451f8ae9180;hb=afe7915ab09b83bf036b1c9c0abdd95e7cbe415b;hp=1137b407ac92e051096d648616912357f0ceae72;hpb=0e2503fc5e7d8b5884682734074e7ec6ef0cd52f;p=poolifier.git diff --git a/tests/pools/cluster/fixed.test.js b/tests/pools/cluster/fixed.test.js index 1137b407..a5eaa29a 100644 --- a/tests/pools/cluster/fixed.test.js +++ b/tests/pools/cluster/fixed.test.js @@ -2,7 +2,6 @@ const expect = require('expect') const { FixedClusterPool } = require('../../../lib/index') const TestUtils = require('../../test-utils') const numberOfWorkers = 10 -const maxTasks = 500 const pool = new FixedClusterPool( numberOfWorkers, './tests/worker-files/cluster/testWorker.js', @@ -34,10 +33,7 @@ const asyncErrorPool = new FixedClusterPool( ) const asyncPool = new FixedClusterPool( 1, - './tests/worker-files/cluster/asyncWorker.js', - { - maxTasks: maxTasks - } + './tests/worker-files/cluster/asyncWorker.js' ) describe('Fixed cluster pool test suite', () => { @@ -118,11 +114,6 @@ describe('Fixed cluster pool test suite', () => { expect(usedTime).toBeGreaterThanOrEqual(2000) }) - it('Verify that maxTasks is set properly', async () => { - const worker = asyncPool.chooseWorker() - expect(worker.getMaxListeners()).toBe(maxTasks) - }) - it('Shutdown test', async () => { const exitPromise = TestUtils.waitExits(pool, numberOfWorkers) await pool.destroy() @@ -140,4 +131,11 @@ describe('Fixed cluster pool test suite', () => { // We need to clean up the resources after our test await pool1.destroy() }) + + it('Verify that a pool with zero worker fails', async () => { + expect( + () => + new FixedClusterPool(0, './tests/worker-files/cluster/testWorker.js') + ).toThrowError(new Error('Cannot instantiate a fixed pool with no worker')) + }) })