X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fpools%2Fselection-strategies%2Fselection-strategies.test.mjs;h=5241168cd880e101d2ed793831583398a209488d;hb=ea4b5fd037c5fe09eb6a2810332ad6bed1b5bc7f;hp=39a2ccc3f7ce0cd84ad995165a85a9227341c688;hpb=d35e571704515a8b729d3455e4784054f07c368f;p=poolifier.git diff --git a/tests/pools/selection-strategies/selection-strategies.test.mjs b/tests/pools/selection-strategies/selection-strategies.test.mjs index 39a2ccc3..5241168c 100644 --- a/tests/pools/selection-strategies/selection-strategies.test.mjs +++ b/tests/pools/selection-strategies/selection-strategies.test.mjs @@ -1,4 +1,6 @@ import { expect } from 'expect' + +import { CircularArray } from '../../../lib/circular-array.cjs' import { DynamicClusterPool, DynamicThreadPool, @@ -6,7 +8,6 @@ import { FixedThreadPool, WorkerChoiceStrategies } from '../../../lib/index.cjs' -import { CircularArray } from '../../../lib/circular-array.cjs' describe('Selection strategies test suite', () => { const min = 0 @@ -66,19 +67,6 @@ describe('Selection strategies test suite', () => { expect(pool.workerChoiceStrategyContext.workerChoiceStrategy).toBe( workerChoiceStrategy ) - expect(pool.opts.workerChoiceStrategyOptions).toBeUndefined() - expect(pool.workerChoiceStrategyContext.opts).toStrictEqual({ - retries: - pool.info.maxSize + - Object.keys(pool.workerChoiceStrategyContext.opts.weights).length, - runTime: { median: false }, - waitTime: { median: false }, - elu: { median: false }, - weights: expect.objectContaining({ - 0: expect.any(Number), - [pool.info.maxSize - 1]: expect.any(Number) - }) - }) await pool.destroy() } for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) { @@ -92,19 +80,6 @@ describe('Selection strategies test suite', () => { expect(pool.workerChoiceStrategyContext.workerChoiceStrategy).toBe( workerChoiceStrategy ) - expect(pool.opts.workerChoiceStrategyOptions).toBeUndefined() - expect(pool.workerChoiceStrategyContext.opts).toStrictEqual({ - retries: - pool.info.maxSize + - Object.keys(pool.workerChoiceStrategyContext.opts.weights).length, - runTime: { median: false }, - waitTime: { median: false }, - elu: { median: false }, - weights: expect.objectContaining({ - 0: expect.any(Number), - [pool.info.maxSize - 1]: expect.any(Number) - }) - }) await pool.destroy() } }) @@ -169,25 +144,6 @@ describe('Selection strategies test suite', () => { await pool.destroy() }) - it('Verify strategies wait for worker node readiness in dynamic pool', async () => { - const pool = new DynamicThreadPool( - min, - max, - './tests/worker-files/thread/testWorker.mjs' - ) - expect(pool.starting).toBe(false) - expect(pool.workerNodes.length).toBe(min) - const maxMultiplier = 10000 - const promises = new Set() - for (let i = 0; i < max * maxMultiplier; i++) { - promises.add(pool.execute()) - } - await Promise.all(promises) - expect(pool.workerNodes.length).toBe(max) - // We need to clean up the resources after our test - await pool.destroy() - }) - it('Verify ROUND_ROBIN strategy default policy', async () => { const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN let pool = new FixedThreadPool(