const { waitPoolEvents, waitWorkerEvents } = require('../../test-utils')
describe('Fixed cluster pool test suite', () => {
- const numberOfWorkers = 6
+ const numberOfWorkers = 8
const tasksConcurrency = 2
const pool = new FixedClusterPool(
numberOfWorkers,
expect(workerNode.usage.tasks.maxQueued).toBe(
maxMultiplier - queuePool.opts.tasksQueueOptions.concurrency
)
+ expect(workerNode.usage.tasks.stolen).toBe(0)
}
+ expect(queuePool.info.executedTasks).toBe(0)
expect(queuePool.info.executingTasks).toBe(
numberOfWorkers * queuePool.opts.tasksQueueOptions.concurrency
)
(maxMultiplier - queuePool.opts.tasksQueueOptions.concurrency)
)
expect(queuePool.info.backPressure).toBe(false)
+ expect(queuePool.info.stolenTasks).toBe(0)
await Promise.all(promises)
for (const workerNode of queuePool.workerNodes) {
expect(workerNode.usage.tasks.executing).toBeGreaterThanOrEqual(0)
expect(workerNode.usage.tasks.maxQueued).toBe(
maxMultiplier - queuePool.opts.tasksQueueOptions.concurrency
)
+ expect(workerNode.usage.tasks.stolen).toBeGreaterThanOrEqual(0)
+ expect(workerNode.usage.tasks.stolen).toBeLessThanOrEqual(
+ numberOfWorkers * maxMultiplier
+ )
}
+ expect(queuePool.info.executedTasks).toBe(numberOfWorkers * maxMultiplier)
+ expect(queuePool.info.backPressure).toBe(false)
+ expect(queuePool.info.stolenTasks).toBeGreaterThanOrEqual(0)
+ expect(queuePool.info.stolenTasks).toBeLessThanOrEqual(
+ numberOfWorkers * maxMultiplier
+ )
})
it('Verify that is possible to have a worker that return undefined', async () => {