From: Jérôme Benoit Date: Thu, 29 Aug 2024 17:12:32 +0000 (+0200) Subject: test: refine pool event tests expectation X-Git-Tag: v4.2.8~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6a307669ef6f5aae3a8b79504255a8d3bdfd7c86;p=poolifier.git test: refine pool event tests expectation Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/abstract-pool.test.mjs b/tests/pools/abstract-pool.test.mjs index 2e6ba76b..63162e3a 100644 --- a/tests/pools/abstract-pool.test.mjs +++ b/tests/pools/abstract-pool.test.mjs @@ -1178,12 +1178,12 @@ describe('Abstract pool test suite', () => { await Promise.all(promises) expect(poolBusy).toBe(1) expect(poolBusyInfo).toStrictEqual({ - busyWorkerNodes: expect.any(Number), + busyWorkerNodes: numberOfWorkers, defaultStrategy: WorkerChoiceStrategies.ROUND_ROBIN, executedTasks: expect.any(Number), executingTasks: expect.any(Number), failedTasks: expect.any(Number), - idleWorkerNodes: expect.any(Number), + idleWorkerNodes: 0, maxSize: numberOfWorkers, minSize: numberOfWorkers, ready: true, @@ -1212,6 +1212,7 @@ describe('Abstract pool test suite', () => { worker: WorkerTypes.thread, workerNodes: numberOfWorkers, }) + expect(poolBusyEndInfo.busyWorkerNodes).toBeLessThan(numberOfWorkers) await pool.destroy() }) @@ -1316,7 +1317,7 @@ describe('Abstract pool test suite', () => { expect(poolBackPressure).toBe(1) expect(poolBackPressureInfo).toStrictEqual({ backPressure: true, - backPressureWorkerNodes: expect.any(Number), + backPressureWorkerNodes: numberOfWorkers, busyWorkerNodes: expect.any(Number), defaultStrategy: WorkerChoiceStrategies.ROUND_ROBIN, executedTasks: expect.any(Number), @@ -1361,6 +1362,9 @@ describe('Abstract pool test suite', () => { worker: WorkerTypes.thread, workerNodes: numberOfWorkers, }) + expect(poolBackPressureEndInfo.backPressureWorkerNodes).toBeLessThan( + numberOfWorkers + ) await pool.destroy() })