From: Jérôme Benoit Date: Mon, 10 Oct 2022 16:32:03 +0000 (+0200) Subject: Verify that the configured worker choice is going to be used when a X-Git-Tag: v2.3.1~38 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=87c65328003f70331a3bed5e7a2b617e2e4d9f3d;p=poolifier.git Verify that the configured worker choice is going to be used when a dynamic pool is busy 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 ae608fda..c33dad80 100644 --- a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js +++ b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js @@ -108,6 +108,9 @@ describe('Worker choice strategy context test suite', () => { expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( DynamicPoolWorkerChoiceStrategy ) + expect( + workerChoiceStrategyContext.workerChoiceStrategy.workerChoiceStrategy + ).toBeInstanceOf(RoundRobinWorkerChoiceStrategy) }) it('Verify that setWorkerChoiceStrategy() works with LESS_RECENTLY_USED and fixed pool', () => { @@ -132,6 +135,9 @@ describe('Worker choice strategy context test suite', () => { expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( DynamicPoolWorkerChoiceStrategy ) + expect( + workerChoiceStrategyContext.workerChoiceStrategy.workerChoiceStrategy + ).toBeInstanceOf(LessRecentlyUsedWorkerChoiceStrategy) }) it('Verify that setWorkerChoiceStrategy() works with FAIR_SHARE and fixed pool', () => { @@ -156,6 +162,9 @@ describe('Worker choice strategy context test suite', () => { expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( DynamicPoolWorkerChoiceStrategy ) + expect( + workerChoiceStrategyContext.workerChoiceStrategy.workerChoiceStrategy + ).toBeInstanceOf(FairShareWorkerChoiceStrategy) }) it('Verify that setWorkerChoiceStrategy() works with WEIGHTED_ROUND_ROBIN and fixed pool', () => { @@ -180,5 +189,8 @@ describe('Worker choice strategy context test suite', () => { expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( DynamicPoolWorkerChoiceStrategy ) + expect( + workerChoiceStrategyContext.workerChoiceStrategy.workerChoiceStrategy + ).toBeInstanceOf(WeightedRoundRobinWorkerChoiceStrategy) }) })