From 9ef8fa7151c480590cce9cf98070c313717ad7b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 21 Dec 2023 01:10:02 +0100 Subject: [PATCH] test: improve IWRR coverage MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../selection-strategies.test.mjs | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/tests/pools/selection-strategies/selection-strategies.test.mjs b/tests/pools/selection-strategies/selection-strategies.test.mjs index 0feb5387..a13d1dad 100644 --- a/tests/pools/selection-strategies/selection-strategies.test.mjs +++ b/tests/pools/selection-strategies/selection-strategies.test.mjs @@ -157,6 +157,13 @@ describe('Selection strategies test suite', () => { workerChoiceStrategy ).roundWeights.length ).toBe(1) + expect( + Number.isSafeInteger( + pool.workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ).roundWeights[0] + ) + ).toBe(true) } } await pool.destroy() @@ -1961,7 +1968,7 @@ describe('Selection strategies test suite', () => { await pool.destroy() }) - it.skip('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a fixed pool', async () => { + it('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a fixed pool', async () => { const pool = new FixedThreadPool( max, './tests/worker-files/thread/testWorker.mjs', @@ -2033,11 +2040,18 @@ describe('Selection strategies test suite', () => { pool.workerChoiceStrategyContext.workerChoiceStrategy ).roundWeights.length ).toBe(1) + expect( + Number.isSafeInteger( + pool.workerChoiceStrategyContext.workerChoiceStrategies.get( + pool.workerChoiceStrategyContext.workerChoiceStrategy + ).roundWeights[0] + ) + ).toBe(true) // We need to clean up the resources after our test await pool.destroy() }) - it.skip('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool', async () => { + it('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool', async () => { const pool = new DynamicThreadPool( min, max, @@ -2110,6 +2124,13 @@ describe('Selection strategies test suite', () => { pool.workerChoiceStrategyContext.workerChoiceStrategy ).roundWeights.length ).toBe(1) + expect( + Number.isSafeInteger( + pool.workerChoiceStrategyContext.workerChoiceStrategies.get( + pool.workerChoiceStrategyContext.workerChoiceStrategy + ).roundWeights[0] + ) + ).toBe(true) // We need to clean up the resources after our test await pool.destroy() }) @@ -2172,6 +2193,13 @@ describe('Selection strategies test suite', () => { pool.workerChoiceStrategyContext.workerChoiceStrategy ).roundWeights.length ).toBe(1) + expect( + Number.isSafeInteger( + pool.workerChoiceStrategyContext.workerChoiceStrategies.get( + pool.workerChoiceStrategyContext.workerChoiceStrategy + ).roundWeights[0] + ) + ).toBe(true) await pool.destroy() pool = new DynamicThreadPool( min, @@ -2229,6 +2257,13 @@ describe('Selection strategies test suite', () => { pool.workerChoiceStrategyContext.workerChoiceStrategy ).roundWeights.length ).toBe(1) + expect( + Number.isSafeInteger( + pool.workerChoiceStrategyContext.workerChoiceStrategies.get( + pool.workerChoiceStrategyContext.workerChoiceStrategy + ).roundWeights[0] + ) + ).toBe(true) // We need to clean up the resources after our test await pool.destroy() }) -- 2.34.1