From: Jérôme Benoit Date: Thu, 6 Apr 2023 07:58:45 +0000 (+0200) Subject: test: enhance worker selection strategies UTs X-Git-Tag: v2.4.2~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=283855e19b579c0b4942b32e1a6b4ff0efa6b801;p=poolifier.git test: enhance worker selection strategies UTs Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js index 7c46601f..2c0250ef 100644 --- a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js +++ b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js @@ -106,6 +106,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.ROUND_ROBIN + ).isDynamicPool + ).toBe(false) expect( workerChoiceStrategyContext.workerChoiceStrategies.get( WorkerChoiceStrategies.ROUND_ROBIN @@ -131,6 +136,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.ROUND_ROBIN + ).isDynamicPool + ).toBe(true) expect( workerChoiceStrategyContext.workerChoiceStrategies.get( WorkerChoiceStrategies.ROUND_ROBIN @@ -156,6 +166,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.LESS_USED + ).isDynamicPool + ).toBe(false) workerChoiceStrategyContext.setWorkerChoiceStrategy( WorkerChoiceStrategies.LESS_USED ) @@ -173,6 +188,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.LESS_USED + ).isDynamicPool + ).toBe(true) workerChoiceStrategyContext.setWorkerChoiceStrategy( WorkerChoiceStrategies.LESS_USED ) @@ -190,6 +210,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.LESS_BUSY + ).isDynamicPool + ).toBe(false) workerChoiceStrategyContext.setWorkerChoiceStrategy( WorkerChoiceStrategies.LESS_BUSY ) @@ -207,6 +232,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.LESS_BUSY + ).isDynamicPool + ).toBe(true) workerChoiceStrategyContext.setWorkerChoiceStrategy( WorkerChoiceStrategies.LESS_BUSY ) @@ -224,6 +254,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.FAIR_SHARE + ).isDynamicPool + ).toBe(false) workerChoiceStrategyContext.setWorkerChoiceStrategy( WorkerChoiceStrategies.FAIR_SHARE ) @@ -241,6 +276,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.FAIR_SHARE + ).isDynamicPool + ).toBe(true) workerChoiceStrategyContext.setWorkerChoiceStrategy( WorkerChoiceStrategies.FAIR_SHARE ) @@ -258,6 +298,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN + ).isDynamicPool + ).toBe(false) workerChoiceStrategyContext.setWorkerChoiceStrategy( WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN ) @@ -275,6 +320,11 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN + ).isDynamicPool + ).toBe(true) workerChoiceStrategyContext.setWorkerChoiceStrategy( WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN )