From: Jérôme Benoit Date: Tue, 15 Jul 2025 09:53:17 +0000 (+0200) Subject: test: delay pool destroy X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=68e5663a85ec5932a71abc81b938a730934d1fb5;p=poolifier.git test: delay pool destroy Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/cluster/fixed.test.mjs b/tests/pools/cluster/fixed.test.mjs index 20cfbee86..3ff1724b3 100644 --- a/tests/pools/cluster/fixed.test.mjs +++ b/tests/pools/cluster/fixed.test.mjs @@ -4,7 +4,7 @@ import cluster from 'node:cluster' import { FixedClusterPool, PoolEvents } from '../../../lib/index.cjs' import { DEFAULT_TASK_NAME } from '../../../lib/utils.cjs' import { TaskFunctions } from '../../test-types.cjs' -import { waitWorkerEvents } from '../../test-utils.cjs' +import { sleep, waitWorkerEvents } from '../../test-utils.cjs' describe('Fixed cluster pool test suite', () => { const numberOfWorkers = 8 @@ -335,6 +335,7 @@ describe('Fixed cluster pool test suite', () => { expect(exitEvent).toBe(1) // Simulates an illegitimate worker node destroy and the minimum number of worker nodes is guaranteed expect(pool.workerNodes.length).toBe(numberOfWorkers) + await sleep(500) await pool.destroy() }) diff --git a/tests/pools/thread/fixed.test.mjs b/tests/pools/thread/fixed.test.mjs index cecabd2b3..11f707001 100644 --- a/tests/pools/thread/fixed.test.mjs +++ b/tests/pools/thread/fixed.test.mjs @@ -351,6 +351,7 @@ describe('Fixed thread pool test suite', () => { expect(exitEvent).toBe(1) // Simulates an illegitimate worker node destroy and the minimum number of worker nodes is guaranteed expect(pool.workerNodes.length).toBe(numberOfThreads) + await sleep(500) await pool.destroy() })