From: Jérôme Benoit Date: Thu, 13 Oct 2022 19:09:44 +0000 (+0200) Subject: Improve strategies internals reset tests X-Git-Tag: v2.3.1~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=38f6e859ac08e5bed3ced3b7940d02de517a1f76;p=poolifier.git Improve strategies internals reset tests Signed-off-by: Jérôme Benoit --- 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