} = require('../../../lib')
const { CircularArray } = require('../../../lib/circular-array')
const { Queue } = require('../../../lib/queue')
+const { version } = require('../../../package.json')
describe('Abstract pool test suite', () => {
const numberOfWorkers = 2
'./tests/worker-files/thread/testWorker.js'
)
expect(pool.info).toStrictEqual({
+ version,
type: PoolTypes.fixed,
worker: WorkerTypes.thread,
minSize: numberOfWorkers,
'./tests/worker-files/cluster/testWorker.js'
)
expect(pool.info).toStrictEqual({
+ version,
type: PoolTypes.dynamic,
worker: WorkerTypes.cluster,
minSize: numberOfWorkers,
},
runTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
waitTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
elu: {
idle: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
active: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
- },
- utilization: 0
+ }
}
})
}
},
runTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
waitTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
elu: {
idle: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
active: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
- },
- utilization: 0
+ }
}
})
}
},
runTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
waitTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
elu: {
idle: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
active: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
- },
- utilization: 0
+ }
}
})
}
},
runTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
waitTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
elu: {
idle: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
active: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
- },
- utilization: 0
+ }
}
})
expect(workerNode.usage.tasks.executed).toBeGreaterThan(0)
},
runTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
waitTime: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
elu: {
idle: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
},
active: {
aggregate: 0,
+ maximum: 0,
+ minimum: 0,
average: 0,
median: 0,
history: expect.any(CircularArray)
- },
- utilization: 0
+ }
}
})
expect(workerNode.usage.runTime.history.length).toBe(0)
// So in total numberOfWorkers * 2 times for a loop submitting up to numberOfWorkers * 2 tasks to the dynamic pool with min = max = numberOfWorkers.
expect(poolFull).toBe(numberOfWorkers * 2)
expect(poolInfo).toStrictEqual({
+ version,
type: PoolTypes.dynamic,
worker: WorkerTypes.thread,
minSize: expect.any(Number),
// So in total numberOfWorkers + 1 times for a loop submitting up to numberOfWorkers * 2 tasks to the fixed pool.
expect(poolBusy).toBe(numberOfWorkers + 1)
expect(poolInfo).toStrictEqual({
+ version,
type: PoolTypes.fixed,
worker: WorkerTypes.thread,
minSize: expect.any(Number),