From 38f6e859ac08e5bed3ced3b7940d02de517a1f76 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 13 Oct 2022 21:09:44 +0200 Subject: [PATCH] Improve strategies internals reset tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../selection-strategies.test.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/pools/selection-strategies/selection-strategies.test.js b/tests/pools/selection-strategies/selection-strategies.test.js index d9a01684..64b26cd5 100644 --- a/tests/pools/selection-strategies/selection-strategies.test.js +++ b/tests/pools/selection-strategies/selection-strategies.test.js @@ -131,6 +131,9 @@ describe('Selection strategies test suite', () => { './tests/worker-files/thread/testWorker.js', { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN } ) + expect( + pool.workerChoiceStrategyContext.getWorkerChoiceStrategy().nextWorkerIndex + ).toBeUndefined() pool.setWorkerChoiceStrategy(WorkerChoiceStrategies.ROUND_ROBIN) expect( pool.workerChoiceStrategyContext.getWorkerChoiceStrategy().nextWorkerIndex @@ -142,6 +145,10 @@ describe('Selection strategies test suite', () => { './tests/worker-files/thread/testWorker.js', { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN } ) + expect( + pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() + .workerChoiceStrategy.nextWorkerIndex + ).toBeUndefined() pool.setWorkerChoiceStrategy(WorkerChoiceStrategies.ROUND_ROBIN) expect( pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() @@ -501,6 +508,18 @@ describe('Selection strategies test suite', () => { max, './tests/worker-files/thread/testWorker.js' ) + expect( + pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() + .previousWorkerIndex + ).toBeUndefined() + expect( + pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() + .currentWorkerIndex + ).toBeUndefined() + expect( + pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() + .defaultWorkerWeight + ).toBeUndefined() expect( pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() .workersTaskRunTime @@ -533,6 +552,18 @@ describe('Selection strategies test suite', () => { max, './tests/worker-files/thread/testWorker.js' ) + expect( + pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() + .workerChoiceStrategy.previousWorkerIndex + ).toBeUndefined() + expect( + pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() + .workerChoiceStrategy.currentWorkerIndex + ).toBeUndefined() + expect( + pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() + .workerChoiceStrategy.defaultWorkerWeight + ).toBeUndefined() expect( pool.workerChoiceStrategyContext.getWorkerChoiceStrategy() .workerChoiceStrategy.workersTaskRunTime -- 2.34.1