X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fcluster%2Fdynamic.test.js;h=291629f59b93f195eaf2d9b4a57f5e2649786af0;hb=4f0b85b32d9241579bbfd4759c44d96e4c968a25;hp=6d2bccadc1f2ae9bce01904443bb475b56ccb6a6;hpb=feec4213515cceb460e722dedca403914764b487;p=poolifier.git diff --git a/tests/pools/cluster/dynamic.test.js b/tests/pools/cluster/dynamic.test.js index 6d2bccad..291629f5 100644 --- a/tests/pools/cluster/dynamic.test.js +++ b/tests/pools/cluster/dynamic.test.js @@ -37,28 +37,28 @@ describe('Dynamic cluster pool test suite', () => { // The `busy` event is triggered when the number of submitted tasks at once reach the max number of workers in the dynamic pool. // So in total numberOfWorkers + 1 times for a loop submitting up to numberOfWorkers * 2 tasks to the dynamic pool. expect(poolBusy).toBe(max + 1) - const numberOfExitEvents = await TestUtils.waitExits(pool, max - min) + const numberOfExitEvents = await TestUtils.waitWorkerExits(pool, max - min) expect(numberOfExitEvents).toBe(max - min) }) it('Verify scale worker up and down is working', async () => { expect(pool.workerNodes.length).toBe(min) - for (let i = 0; i < max * 10; i++) { + for (let i = 0; i < max * 2; i++) { pool.execute() } expect(pool.workerNodes.length).toBeGreaterThan(min) - await TestUtils.waitExits(pool, max - min) + await TestUtils.waitWorkerExits(pool, max - min) expect(pool.workerNodes.length).toBe(min) - for (let i = 0; i < max * 10; i++) { + for (let i = 0; i < max * 2; i++) { pool.execute() } expect(pool.workerNodes.length).toBeGreaterThan(min) - await TestUtils.waitExits(pool, max - min) + await TestUtils.waitWorkerExits(pool, max - min) expect(pool.workerNodes.length).toBe(min) }) it('Shutdown test', async () => { - const exitPromise = TestUtils.waitExits(pool, min) + const exitPromise = TestUtils.waitWorkerExits(pool, min) await pool.destroy() const numberOfExitEvents = await exitPromise expect(numberOfExitEvents).toBe(min) @@ -94,11 +94,11 @@ describe('Dynamic cluster pool test suite', () => { } ) expect(longRunningPool.workerNodes.length).toBe(min) - for (let i = 0; i < max * 10; i++) { + for (let i = 0; i < max * 2; i++) { longRunningPool.execute() } expect(longRunningPool.workerNodes.length).toBe(max) - await TestUtils.waitExits(longRunningPool, max - min) + await TestUtils.waitWorkerExits(longRunningPool, max - min) expect(longRunningPool.workerNodes.length).toBe(min) expect( longRunningPool.workerChoiceStrategyContext.workerChoiceStrategies.get( @@ -121,7 +121,7 @@ describe('Dynamic cluster pool test suite', () => { } ) expect(longRunningPool.workerNodes.length).toBe(min) - for (let i = 0; i < max * 10; i++) { + for (let i = 0; i < max * 2; i++) { longRunningPool.execute() } expect(longRunningPool.workerNodes.length).toBe(max)