From 55a9fbccadf29da6e3cb30471f3a5ce1e0d7c641 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 31 Jul 2024 18:03:43 +0200 Subject: [PATCH] test: remove duplicate 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.mjs | 32 +++++++++++----------------- tests/pools/cluster/fixed.test.mjs | 9 -------- tests/pools/thread/dynamic.test.mjs | 32 +++++++++++----------------- tests/pools/thread/fixed.test.mjs | 9 -------- 4 files changed, 24 insertions(+), 58 deletions(-) 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) -- 2.34.1