X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fselection-strategies%2Fworker-choice-strategy-context.test.js;h=5e202039f67ba4872c594294d480ed8cecb90da6;hb=1dfe8965df029a366c040227fb61ae47b3d59a3a;hp=a93104d225f3e9c27ff8d252719619d20654bf0a;hpb=51fe3d3cb0858b5e2ad96076b51a6b9daa8f852c;p=poolifier.git 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 a93104d2..5e202039 100644 --- a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js +++ b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js @@ -4,7 +4,7 @@ const { FixedThreadPool, DynamicThreadPool, WorkerChoiceStrategies -} = require('../../../lib/index') +} = require('../../../lib') const { WorkerChoiceStrategyContext } = require('../../../lib/pools/selection-strategies/worker-choice-strategy-context') @@ -12,17 +12,20 @@ const { RoundRobinWorkerChoiceStrategy } = require('../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy') const { - LessUsedWorkerChoiceStrategy -} = require('../../../lib/pools/selection-strategies/less-used-worker-choice-strategy') + LeastUsedWorkerChoiceStrategy +} = require('../../../lib/pools/selection-strategies/least-used-worker-choice-strategy') const { - LessBusyWorkerChoiceStrategy -} = require('../../../lib/pools/selection-strategies/less-busy-worker-choice-strategy') + LeastBusyWorkerChoiceStrategy +} = require('../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy') const { FairShareWorkerChoiceStrategy } = require('../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy') const { WeightedRoundRobinWorkerChoiceStrategy } = require('../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy') +const { + InterleavedWeightedRoundRobinWorkerChoiceStrategy +} = require('../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy') describe('Worker choice strategy context test suite', () => { const min = 1 @@ -50,6 +53,15 @@ describe('Worker choice strategy context test suite', () => { await dynamicPool.destroy() }) + it('Verify that constructor() initializes the context with all the available worker choice strategies', () => { + const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( + fixedPool + ) + expect(workerChoiceStrategyContext.workerChoiceStrategies.size).toBe( + Object.keys(WorkerChoiceStrategies).length + ) + }) + it('Verify that execute() return the worker chosen by the strategy with fixed pool', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool @@ -60,14 +72,57 @@ describe('Worker choice strategy context test suite', () => { choose: sinon.stub().returns(0) } ) - workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + WorkerChoiceStrategies.ROUND_ROBIN + ) + workerChoiceStrategyContext.workerChoiceStrategies.set( + workerChoiceStrategyContext.workerChoiceStrategy, + WorkerChoiceStrategyStub + ) const chosenWorkerKey = workerChoiceStrategyContext.execute() expect( - workerChoiceStrategyContext.workerChoiceStrategy.choose.calledOnce + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategyContext.workerChoiceStrategy + ).choose.calledOnce ).toBe(true) expect(chosenWorkerKey).toBe(0) }) + it('Verify that execute() throws error if null or undefined is returned', () => { + const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( + fixedPool + ) + const WorkerChoiceStrategyUndefinedStub = sinon.createStubInstance( + RoundRobinWorkerChoiceStrategy, + { + choose: sinon.stub().returns(undefined) + } + ) + const WorkerChoiceStrategyNullStub = sinon.createStubInstance( + RoundRobinWorkerChoiceStrategy, + { + choose: sinon.stub().returns(null) + } + ) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + WorkerChoiceStrategies.ROUND_ROBIN + ) + workerChoiceStrategyContext.workerChoiceStrategies.set( + workerChoiceStrategyContext.workerChoiceStrategy, + WorkerChoiceStrategyUndefinedStub + ) + expect(() => workerChoiceStrategyContext.execute()).toThrowError( + new Error('Worker node key chosen is null or undefined') + ) + workerChoiceStrategyContext.workerChoiceStrategies.set( + workerChoiceStrategyContext.workerChoiceStrategy, + WorkerChoiceStrategyNullStub + ) + expect(() => workerChoiceStrategyContext.execute()).toThrowError( + new Error('Worker node key chosen is null or undefined') + ) + }) + it('Verify that execute() return the worker chosen by the strategy with dynamic pool', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool @@ -78,261 +133,286 @@ describe('Worker choice strategy context test suite', () => { choose: sinon.stub().returns(0) } ) - workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + WorkerChoiceStrategies.ROUND_ROBIN + ) + workerChoiceStrategyContext.workerChoiceStrategies.set( + workerChoiceStrategyContext.workerChoiceStrategy, + WorkerChoiceStrategyStub + ) const chosenWorkerKey = workerChoiceStrategyContext.execute() expect( - workerChoiceStrategyContext.workerChoiceStrategy.choose.calledOnce + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategyContext.workerChoiceStrategy + ).choose.calledOnce ).toBe(true) expect(chosenWorkerKey).toBe(0) }) it('Verify that setWorkerChoiceStrategy() works with ROUND_ROBIN and fixed pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - RoundRobinWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.ROUND_ROBIN - ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - fixedPool, - WorkerChoiceStrategies.ROUND_ROBIN - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - RoundRobinWorkerChoiceStrategy + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(RoundRobinWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.ROUND_ROBIN + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(RoundRobinWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) it('Verify that setWorkerChoiceStrategy() works with ROUND_ROBIN and dynamic pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - RoundRobinWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.ROUND_ROBIN - ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - dynamicPool, - WorkerChoiceStrategies.ROUND_ROBIN - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - RoundRobinWorkerChoiceStrategy + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(RoundRobinWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.ROUND_ROBIN + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(RoundRobinWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) - it('Verify that setWorkerChoiceStrategy() works with LESS_USED and fixed pool', () => { + it('Verify that setWorkerChoiceStrategy() works with LEAST_USED and fixed pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_USED const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - fixedPool, - WorkerChoiceStrategies.LESS_USED - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - LessUsedWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.LESS_USED + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(LeastUsedWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) - it('Verify that setWorkerChoiceStrategy() works with LESS_USED and dynamic pool', () => { + it('Verify that setWorkerChoiceStrategy() works with LEAST_USED and dynamic pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_USED const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - dynamicPool, - WorkerChoiceStrategies.LESS_USED - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - LessUsedWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.LESS_USED + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(LeastUsedWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) - it('Verify that setWorkerChoiceStrategy() works with LESS_BUSY and fixed pool', () => { + it('Verify that setWorkerChoiceStrategy() works with LEAST_BUSY and fixed pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_BUSY const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - fixedPool, - WorkerChoiceStrategies.LESS_BUSY - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - LessBusyWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.LESS_BUSY + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(LeastBusyWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) - it('Verify that setWorkerChoiceStrategy() works with LESS_BUSY and dynamic pool', () => { + it('Verify that setWorkerChoiceStrategy() works with LEAST_BUSY and dynamic pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_BUSY const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - dynamicPool, - WorkerChoiceStrategies.LESS_BUSY - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - LessBusyWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.LESS_BUSY + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(LeastBusyWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) it('Verify that setWorkerChoiceStrategy() works with FAIR_SHARE and fixed pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.FAIR_SHARE const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - fixedPool, - WorkerChoiceStrategies.FAIR_SHARE - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - FairShareWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.FAIR_SHARE + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(FairShareWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) it('Verify that setWorkerChoiceStrategy() works with FAIR_SHARE and dynamic pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.FAIR_SHARE const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - dynamicPool, - WorkerChoiceStrategies.FAIR_SHARE - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - FairShareWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.FAIR_SHARE + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(FairShareWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) it('Verify that setWorkerChoiceStrategy() works with WEIGHTED_ROUND_ROBIN and fixed pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - fixedPool, - WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - WeightedRoundRobinWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(WeightedRoundRobinWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) it('Verify that setWorkerChoiceStrategy() works with WEIGHTED_ROUND_ROBIN and dynamic pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) - workerChoiceStrategyContext.setWorkerChoiceStrategy( - dynamicPool, - WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBeInstanceOf( - WeightedRoundRobinWorkerChoiceStrategy - ) - expect(workerChoiceStrategyContext.workerChoiceStrategyType).toBe( - WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(WeightedRoundRobinWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) }) - it('Verify that getWorkerChoiceStrategy() default return ROUND_ROBIN strategy', () => { + it('Verify that setWorkerChoiceStrategy() works with INTERLEAVED_WEIGHTED_ROUND_ROBIN and fixed pool', () => { + const workerChoiceStrategy = + WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) - const strategy = - workerChoiceStrategyContext.getWorkerChoiceStrategy(fixedPool) - expect(strategy).toBeInstanceOf(RoundRobinWorkerChoiceStrategy) + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(InterleavedWeightedRoundRobinWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy + ) }) - it('Verify that getWorkerChoiceStrategy() can return ROUND_ROBIN strategy', () => { + it('Verify that setWorkerChoiceStrategy() works with INTERLEAVED_WEIGHTED_ROUND_ROBIN and dynamic pool', () => { + const workerChoiceStrategy = + WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( - fixedPool + dynamicPool ) - const strategy = workerChoiceStrategyContext.getWorkerChoiceStrategy( - fixedPool, - WorkerChoiceStrategies.ROUND_ROBIN + workerChoiceStrategyContext.setWorkerChoiceStrategy(workerChoiceStrategy) + expect( + workerChoiceStrategyContext.workerChoiceStrategies.get( + workerChoiceStrategy + ) + ).toBeInstanceOf(InterleavedWeightedRoundRobinWorkerChoiceStrategy) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + workerChoiceStrategy ) - expect(strategy).toBeInstanceOf(RoundRobinWorkerChoiceStrategy) }) - it('Verify that getWorkerChoiceStrategy() can return LESS_USED strategy', () => { - const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( - fixedPool - ) - const strategy = workerChoiceStrategyContext.getWorkerChoiceStrategy( + it('Verify that worker choice strategy options enable median runtime pool statistics', () => { + const wwrWorkerChoiceStrategy = WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN + let workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool, - WorkerChoiceStrategies.LESS_USED + wwrWorkerChoiceStrategy, + { + medRunTime: true + } ) - expect(strategy).toBeInstanceOf(LessUsedWorkerChoiceStrategy) - }) - - it('Verify that getWorkerChoiceStrategy() can return LESS_BUSY strategy', () => { - const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( - fixedPool + expect(workerChoiceStrategyContext.getTaskStatistics().avgRunTime).toBe( + false ) - const strategy = workerChoiceStrategyContext.getWorkerChoiceStrategy( - fixedPool, - WorkerChoiceStrategies.LESS_BUSY + expect(workerChoiceStrategyContext.getTaskStatistics().medRunTime).toBe( + true ) - expect(strategy).toBeInstanceOf(LessBusyWorkerChoiceStrategy) - }) - - it('Verify that getWorkerChoiceStrategy() can return FAIR_SHARE strategy', () => { - const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( - fixedPool + workerChoiceStrategyContext = new WorkerChoiceStrategyContext( + dynamicPool, + wwrWorkerChoiceStrategy, + { + medRunTime: true + } ) - const strategy = workerChoiceStrategyContext.getWorkerChoiceStrategy( - fixedPool, - WorkerChoiceStrategies.FAIR_SHARE + expect(workerChoiceStrategyContext.getTaskStatistics().avgRunTime).toBe( + false ) - expect(strategy).toBeInstanceOf(FairShareWorkerChoiceStrategy) - }) - - it('Verify that getWorkerChoiceStrategy() can return WEIGHTED_ROUND_ROBIN strategy', () => { - const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( - fixedPool + expect(workerChoiceStrategyContext.getTaskStatistics().medRunTime).toBe( + true ) - const strategy = workerChoiceStrategyContext.getWorkerChoiceStrategy( + const fsWorkerChoiceStrategy = WorkerChoiceStrategies.FAIR_SHARE + workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool, - WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN + fsWorkerChoiceStrategy, + { + medRunTime: true + } ) - expect(strategy).toBeInstanceOf(WeightedRoundRobinWorkerChoiceStrategy) - }) - - it('Verify that getWorkerChoiceStrategy() throw error on unknown strategy', () => { - const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( - fixedPool + expect(workerChoiceStrategyContext.getTaskStatistics().avgRunTime).toBe( + false ) - expect(() => { - workerChoiceStrategyContext.getWorkerChoiceStrategy( - fixedPool, - 'UNKNOWN_STRATEGY' - ) - }).toThrowError( - new Error("Worker choice strategy 'UNKNOWN_STRATEGY' not found") + expect(workerChoiceStrategyContext.getTaskStatistics().medRunTime).toBe( + true + ) + workerChoiceStrategyContext = new WorkerChoiceStrategyContext( + dynamicPool, + fsWorkerChoiceStrategy, + { + medRunTime: true + } + ) + expect(workerChoiceStrategyContext.getTaskStatistics().avgRunTime).toBe( + false + ) + expect(workerChoiceStrategyContext.getTaskStatistics().medRunTime).toBe( + true ) }) })