From: Jérôme Benoit Date: Wed, 12 Oct 2022 17:45:31 +0000 (+0200) Subject: Tests: check strategy internal statistics at pool creation X-Git-Tag: v2.3.1~14 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6e7fa401ce994a6ddb74d8ff1cc9e5a171270afd;p=poolifier.git Tests: check strategy internal statistics at pool creation 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 7b11bf40..49e87a92 100644 --- a/tests/pools/selection-strategies/selection-strategies.test.js +++ b/tests/pools/selection-strategies/selection-strategies.test.js @@ -202,6 +202,18 @@ describe('Selection strategies test suite', () => { expect(pool.opts.workerChoiceStrategy).toBe( WorkerChoiceStrategies.FAIR_SHARE ) + for (const worker of pool.workerChoiceStrategyContext.workerChoiceStrategy.workerLastVirtualTaskTimestamp.keys()) { + expect( + pool.workerChoiceStrategyContext.workerChoiceStrategy.workerLastVirtualTaskTimestamp.get( + worker + ).start + ).toBe(0) + expect( + pool.workerChoiceStrategyContext.workerChoiceStrategy.workerLastVirtualTaskTimestamp.get( + worker + ).end + ).toBe(0) + } // We need to clean up the resources after our test await pool.destroy() }) @@ -335,6 +347,13 @@ describe('Selection strategies test suite', () => { expect(pool.opts.workerChoiceStrategy).toBe( WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN ) + for (const worker of pool.workerChoiceStrategyContext.workerChoiceStrategy.workersTaskRunTime.keys()) { + expect( + pool.workerChoiceStrategyContext.workerChoiceStrategy.workersTaskRunTime.get( + worker + ).runTime + ).toBe(0) + } // We need to clean up the resources after our test await pool.destroy() })