From: Jérôme Benoit Date: Wed, 31 Jul 2024 16:03:43 +0000 (+0200) Subject: test: remove duplicate tests X-Git-Tag: v4.2.0~33 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=55a9fbccadf29da6e3cb30471f3a5ce1e0d7c641;p=poolifier.git test: remove duplicate tests Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/cluster/dynamic.test.mjs b/tests/pools/cluster/dynamic.test.mjs index f5094452..c93a6711 100644 --- a/tests/pools/cluster/dynamic.test.mjs +++ b/tests/pools/cluster/dynamic.test.mjs @@ -11,14 +11,18 @@ import { sleep, waitPoolEvents, waitWorkerEvents } from '../../test-utils.cjs' describe('Dynamic cluster pool test suite', () => { const min = 1 const max = 3 - const pool = new DynamicClusterPool( - min, - max, - './tests/worker-files/cluster/testWorker.cjs', - { - errorHandler: e => console.error(e), - } - ) + let pool + + before('Create pool', () => { + pool = new DynamicClusterPool( + min, + max, + './tests/worker-files/cluster/testWorker.cjs', + { + errorHandler: e => console.error(e), + } + ) + }) it('Verify that the function is executed in a worker cluster', async () => { let result = await pool.execute({ @@ -88,18 +92,6 @@ describe('Dynamic cluster pool test suite', () => { ) }) - it('Should work even without opts in input', async () => { - const pool = new DynamicClusterPool( - min, - max, - './tests/worker-files/cluster/testWorker.cjs' - ) - const result = await pool.execute() - expect(result).toStrictEqual({ ok: 1 }) - // We need to clean up the resources after our test - await pool.destroy() - }) - it('Verify scale processes up and down is working when long executing task is used:hard', async () => { const longRunningPool = new DynamicClusterPool( min, diff --git a/tests/pools/cluster/fixed.test.mjs b/tests/pools/cluster/fixed.test.mjs index c4279236..68808f60 100644 --- a/tests/pools/cluster/fixed.test.mjs +++ b/tests/pools/cluster/fixed.test.mjs @@ -313,15 +313,6 @@ describe('Fixed cluster pool test suite', () => { await pool.destroy() }) - it('Should work even without opts in input', async () => { - const workerFilePath = './tests/worker-files/cluster/testWorker.cjs' - const pool = new FixedClusterPool(numberOfWorkers, workerFilePath) - const res = await pool.execute() - expect(res).toStrictEqual({ ok: 1 }) - // We need to clean up the resources after our test - await pool.destroy() - }) - it('Verify destroyWorkerNode()', async () => { const workerFilePath = './tests/worker-files/cluster/testWorker.cjs' const pool = new FixedClusterPool(numberOfWorkers, workerFilePath) diff --git a/tests/pools/thread/dynamic.test.mjs b/tests/pools/thread/dynamic.test.mjs index 97bfbbfc..ab2d7f9c 100644 --- a/tests/pools/thread/dynamic.test.mjs +++ b/tests/pools/thread/dynamic.test.mjs @@ -11,14 +11,18 @@ import { sleep, waitPoolEvents, waitWorkerEvents } from '../../test-utils.cjs' describe('Dynamic thread pool test suite', () => { const min = 1 const max = 3 - const pool = new DynamicThreadPool( - min, - max, - './tests/worker-files/thread/testWorker.mjs', - { - errorHandler: e => console.error(e), - } - ) + let pool + + before('Create pool', () => { + pool = new DynamicThreadPool( + min, + max, + './tests/worker-files/thread/testWorker.mjs', + { + errorHandler: e => console.error(e), + } + ) + }) it('Verify that the function is executed in a worker thread', async () => { let result = await pool.execute({ @@ -88,18 +92,6 @@ describe('Dynamic thread pool test suite', () => { ) }) - it('Should work even without opts in input', async () => { - const pool = new DynamicThreadPool( - min, - max, - './tests/worker-files/thread/testWorker.mjs' - ) - const res = await pool.execute() - expect(res).toStrictEqual({ ok: 1 }) - // We need to clean up the resources after our test - await pool.destroy() - }) - it('Verify scale thread up and down is working when long executing task is used:hard', async () => { const longRunningPool = new DynamicThreadPool( min, diff --git a/tests/pools/thread/fixed.test.mjs b/tests/pools/thread/fixed.test.mjs index e78ed180..15698ae7 100644 --- a/tests/pools/thread/fixed.test.mjs +++ b/tests/pools/thread/fixed.test.mjs @@ -333,15 +333,6 @@ describe('Fixed thread pool test suite', () => { await pool.destroy() }) - it('Should work even without opts in input', async () => { - const workerFilePath = './tests/worker-files/thread/testWorker.mjs' - const pool = new FixedThreadPool(numberOfThreads, workerFilePath) - const res = await pool.execute() - expect(res).toStrictEqual({ ok: 1 }) - // We need to clean up the resources after our test - await pool.destroy() - }) - it('Verify destroyWorkerNode()', async () => { const workerFilePath = './tests/worker-files/thread/testWorker.mjs' const pool = new FixedThreadPool(numberOfThreads, workerFilePath)