X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fpools%2Fselection-strategies%2Fselection-strategies.test.js;h=6671b57781b1f51c15bdf0717f3c96cafcf0ca76;hb=c62a9bbc12416e26acbb3b86b5090d6186b14b60;hp=535f5f974559ab7748ac885c476f064084e148e6;hpb=3f7d99f5a6b9783554886f1850aa45c5bc237b65;p=poolifier.git diff --git a/tests/pools/selection-strategies/selection-strategies.test.js b/tests/pools/selection-strategies/selection-strategies.test.js index 535f5f97..6671b577 100644 --- a/tests/pools/selection-strategies/selection-strategies.test.js +++ b/tests/pools/selection-strategies/selection-strategies.test.js @@ -3,11 +3,9 @@ const { DynamicThreadPool, FixedClusterPool, FixedThreadPool, - PoolEvents, WorkerChoiceStrategies } = require('../../../lib') const { CircularArray } = require('../../../lib/circular-array') -const { waitPoolEvents } = require('../../test-utils') describe('Selection strategies test suite', () => { const min = 0 @@ -1717,9 +1715,6 @@ describe('Selection strategies test suite', () => { WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN } ) - if (!pool.info.ready) { - await waitPoolEvents(pool, PoolEvents.ready, 1) - } // TODO: Create a better test to cover `InterleavedWeightedRoundRobinWorkerChoiceStrategy#choose` const promises = new Set() const maxMultiplier = 2 @@ -1790,9 +1785,6 @@ describe('Selection strategies test suite', () => { WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN } ) - if (!pool.info.ready) { - await waitPoolEvents(pool, PoolEvents.ready, 1) - } // TODO: Create a better test to cover `InterleavedWeightedRoundRobinWorkerChoiceStrategy#choose` const promises = new Set() const maxMultiplier = 2 @@ -1803,7 +1795,7 @@ describe('Selection strategies test suite', () => { for (const workerNode of pool.workerNodes) { expect(workerNode.usage).toStrictEqual({ tasks: { - executed: expect.any(Number), + executed: maxMultiplier, executing: 0, queued: 0, maxQueued: 0, @@ -1839,7 +1831,7 @@ describe('Selection strategies test suite', () => { pool.workerChoiceStrategyContext.workerChoiceStrategies.get( pool.workerChoiceStrategyContext.workerChoiceStrategy ).nextWorkerNodeKey - ).toBe(1) + ).toBe(0) expect( pool.workerChoiceStrategyContext.workerChoiceStrategies.get( pool.workerChoiceStrategyContext.workerChoiceStrategy