X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fpools%2Fabstract%2Fabstract-pool.test.js;h=d4b147f78f4cd13e62aedbf5a8cac0af8d56884a;hb=f751010550f07200428ca708afb2ec1d242cf7a7;hp=023b56b414c4c3453d269c5f5605d0e69a8c4275;hpb=afe0d5bfcc23c3acb7278eef7fac7b1b39d241cc;p=poolifier.git diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index 023b56b4..d4b147f7 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -11,6 +11,7 @@ const { } = 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 @@ -393,11 +394,11 @@ describe('Abstract pool test suite', () => { './tests/worker-files/thread/testWorker.js' ) expect(pool.info).toStrictEqual({ + version, type: PoolTypes.fixed, worker: WorkerTypes.thread, minSize: numberOfWorkers, maxSize: numberOfWorkers, - utilization: 0, workerNodes: numberOfWorkers, idleWorkerNodes: numberOfWorkers, busyWorkerNodes: 0, @@ -414,11 +415,11 @@ describe('Abstract pool test suite', () => { './tests/worker-files/cluster/testWorker.js' ) expect(pool.info).toStrictEqual({ + version, type: PoolTypes.dynamic, worker: WorkerTypes.cluster, minSize: numberOfWorkers, maxSize: numberOfWorkers * 2, - utilization: 0, workerNodes: numberOfWorkers, idleWorkerNodes: numberOfWorkers, busyWorkerNodes: 0, @@ -462,12 +463,16 @@ describe('Abstract pool test suite', () => { }, 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) @@ -475,17 +480,20 @@ describe('Abstract pool test suite', () => { 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 + } } }) } @@ -527,12 +535,16 @@ describe('Abstract pool test suite', () => { }, 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) @@ -540,17 +552,20 @@ describe('Abstract pool test suite', () => { 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 + } } }) } @@ -566,12 +581,16 @@ describe('Abstract pool test suite', () => { }, 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) @@ -579,17 +598,20 @@ describe('Abstract pool test suite', () => { 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 + } } }) } @@ -619,12 +641,16 @@ describe('Abstract pool test suite', () => { }, 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) @@ -632,17 +658,20 @@ describe('Abstract pool test suite', () => { 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) @@ -660,12 +689,16 @@ describe('Abstract pool test suite', () => { }, 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) @@ -673,17 +706,20 @@ describe('Abstract pool test suite', () => { 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) @@ -713,11 +749,11 @@ describe('Abstract pool test suite', () => { // 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), maxSize: expect.any(Number), - utilization: 0, workerNodes: expect.any(Number), idleWorkerNodes: expect.any(Number), busyWorkerNodes: expect.any(Number), @@ -750,11 +786,11 @@ describe('Abstract pool test suite', () => { // 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), maxSize: expect.any(Number), - utilization: 0, workerNodes: expect.any(Number), idleWorkerNodes: expect.any(Number), busyWorkerNodes: expect.any(Number),