X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fcluster%2Fdynamic.test.js;h=53a5f8d0b232e18ac26effb3ccfe466297f5458a;hb=3be5ac00a9f736bda56c5ef053c4cd3b17f851f6;hp=fbeb77cf3555c76ce1a93b53b926cee8f505ce91;hpb=85a3f8a7b3087e7240c1d307ba6dd78c05883f83;p=poolifier.git diff --git a/tests/pools/cluster/dynamic.test.js b/tests/pools/cluster/dynamic.test.js index fbeb77cf..53a5f8d0 100644 --- a/tests/pools/cluster/dynamic.test.js +++ b/tests/pools/cluster/dynamic.test.js @@ -12,7 +12,7 @@ const pool = new DynamicClusterPool( } ) -describe('Dynamic cluster pool test suite ', () => { +describe('Dynamic cluster pool test suite', () => { it('Verify that the function is executed in a worker cluster', async () => { const result = await pool.execute({ test: 'test' }) expect(result).toBeDefined() @@ -62,8 +62,10 @@ describe('Dynamic cluster pool test suite ', () => { 1, './tests/worker-files/cluster/testWorker.js' ) - const res = await pool1.execute({ test: 'test' }) - expect(res).toBeFalsy() + const result = await pool1.execute({ test: 'test' }) + expect(result).toBeFalsy() + // We need to clean up the resources after our test + await pool1.destroy() }) it('Verify scale processes up and down is working when long running task is used:hard', async () => { @@ -80,6 +82,8 @@ describe('Dynamic cluster pool test suite ', () => { await TestUtils.waitExits(longRunningPool, max - min) // Here we expect the workers to be at the max size since that the task is still running expect(longRunningPool.workers.length).toBe(min) + // We need to clean up the resources after our test + await longRunningPool.destroy() }) it('Verify scale processes up and down is working when long running task is used:soft', async () => { @@ -96,5 +100,7 @@ describe('Dynamic cluster pool test suite ', () => { await TestUtils.sleep(1500) // Here we expect the workers to be at the max size since that the task is still running expect(longRunningPool.workers.length).toBe(max) + // We need to clean up the resources after our test + await longRunningPool.destroy() }) })