From ef18443d24959faaf7da0bcd74d10dad43272005 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 10 Oct 2022 01:07:09 +0200 Subject: [PATCH] Revert Promise.all usage in tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/pools/cluster/dynamic.test.js | 2 +- tests/pools/cluster/fixed.test.js | 1 - tests/pools/thread/dynamic.test.js | 2 +- tests/pools/thread/fixed.test.js | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/pools/cluster/dynamic.test.js b/tests/pools/cluster/dynamic.test.js index 9e4a6b23..02a02287 100644 --- a/tests/pools/cluster/dynamic.test.js +++ b/tests/pools/cluster/dynamic.test.js @@ -26,7 +26,7 @@ describe('Dynamic cluster pool test suite', () => { for (let i = 0; i < max * 2; i++) { promises.push(pool.execute({ test: 'test' })) } - await Promise.all(promises) + // await Promise.all(promises) expect(pool.workers.length).toBeLessThanOrEqual(max) expect(pool.workers.length).toBeGreaterThan(min) // The `busy` event is triggered when the number of submitted tasks at once reach the max number of workers in the dynamic pool. diff --git a/tests/pools/cluster/fixed.test.js b/tests/pools/cluster/fixed.test.js index 52ba58d7..2ef709c1 100644 --- a/tests/pools/cluster/fixed.test.js +++ b/tests/pools/cluster/fixed.test.js @@ -74,7 +74,6 @@ describe('Fixed cluster pool test suite', () => { for (let i = 0; i < numberOfWorkers * 2; i++) { promises.push(pool.execute({ test: 'test' })) } - await Promise.all(promises) // The `busy` event is triggered when the number of submitted tasks at once reach the number of fixed pool workers. // So in total numberOfWorkers + 1 times for a loop submitting up to numberOfWorkers * 2 tasks to the fixed pool. expect(poolBusy).toBe(numberOfWorkers + 1) diff --git a/tests/pools/thread/dynamic.test.js b/tests/pools/thread/dynamic.test.js index f345a0ee..8558cb6f 100644 --- a/tests/pools/thread/dynamic.test.js +++ b/tests/pools/thread/dynamic.test.js @@ -26,7 +26,7 @@ describe('Dynamic thread pool test suite', () => { for (let i = 0; i < max * 2; i++) { promises.push(pool.execute({ test: 'test' })) } - await Promise.all(promises) + // await Promise.all(promises) expect(pool.workers.length).toBeLessThanOrEqual(max) expect(pool.workers.length).toBeGreaterThan(min) // The `busy` event is triggered when the number of submitted tasks at once reach the max number of workers in the dynamic pool. diff --git a/tests/pools/thread/fixed.test.js b/tests/pools/thread/fixed.test.js index f89977b3..9af4417c 100644 --- a/tests/pools/thread/fixed.test.js +++ b/tests/pools/thread/fixed.test.js @@ -74,7 +74,7 @@ describe('Fixed thread pool test suite', () => { for (let i = 0; i < numberOfThreads * 2; i++) { promises.push(pool.execute({ test: 'test' })) } - await Promise.all(promises) + // await Promise.all(promises) // The `busy` event is triggered when the number of submitted tasks at once reach the number of fixed pool workers. // So in total numberOfThreads + 1 times for a loop submitting up to numberOfThreads * 2 tasks to the fixed pool. expect(poolBusy).toBe(numberOfThreads + 1) -- 2.34.1