X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fworker-node.test.mjs;h=54a69ca458a8566067c2c8af8160e6605214a6cf;hb=553648c4a0590c524d65422f76fe2c0ed16fc5c3;hp=d6339080b7b001862609ce1fe48366e9791f84f1;hpb=59ca7cfff23a8ad84efaf61ab8c1015e67e97c24;p=poolifier.git diff --git a/tests/pools/worker-node.test.mjs b/tests/pools/worker-node.test.mjs index d6339080..54a69ca4 100644 --- a/tests/pools/worker-node.test.mjs +++ b/tests/pools/worker-node.test.mjs @@ -3,7 +3,7 @@ import { MessageChannel, Worker as ThreadWorker } from 'node:worker_threads' import { expect } from 'expect' -import { CircularArray } from '../../lib/circular-array.cjs' +import { CircularBuffer } from '../../lib/circular-buffer.cjs' import { WorkerTypes } from '../../lib/index.cjs' import { WorkerNode } from '../../lib/pools/worker-node.cjs' import { PriorityQueue } from '../../lib/priority-queue.cjs' @@ -192,7 +192,8 @@ describe('Worker node test suite', () => { type: WorkerTypes.thread, dynamic: false, ready: false, - stealing: false + stealing: false, + backPressure: false }) expect(threadWorkerNode.usage).toStrictEqual({ tasks: { @@ -205,17 +206,17 @@ describe('Worker node test suite', () => { failed: 0 }, runTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, waitTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, elu: { idle: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, active: { - history: new CircularArray() + history: expect.any(CircularBuffer) } } }) @@ -223,11 +224,11 @@ describe('Worker node test suite', () => { expect(threadWorkerNode.tasksQueueBackPressureSize).toBe(12) expect(threadWorkerNode.tasksQueue).toBeInstanceOf(PriorityQueue) expect(threadWorkerNode.tasksQueue.size).toBe(0) - expect(threadWorkerNode.tasksQueue.k).toBe(6) + expect(threadWorkerNode.tasksQueue.bucketSize).toBe(6) expect(threadWorkerNode.tasksQueueSize()).toBe( threadWorkerNode.tasksQueue.size ) - expect(threadWorkerNode.onBackPressureStarted).toBe(false) + expect(threadWorkerNode.setBackPressureFlag).toBe(false) expect(threadWorkerNode.taskFunctionsUsage).toBeInstanceOf(Map) expect(clusterWorkerNode).toBeInstanceOf(WorkerNode) @@ -237,7 +238,8 @@ describe('Worker node test suite', () => { type: WorkerTypes.cluster, dynamic: false, ready: false, - stealing: false + stealing: false, + backPressure: false }) expect(clusterWorkerNode.usage).toStrictEqual({ tasks: { @@ -250,17 +252,17 @@ describe('Worker node test suite', () => { failed: 0 }, runTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, waitTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, elu: { idle: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, active: { - history: new CircularArray() + history: expect.any(CircularBuffer) } } }) @@ -268,11 +270,11 @@ describe('Worker node test suite', () => { expect(clusterWorkerNode.tasksQueueBackPressureSize).toBe(12) expect(clusterWorkerNode.tasksQueue).toBeInstanceOf(PriorityQueue) expect(clusterWorkerNode.tasksQueue.size).toBe(0) - expect(clusterWorkerNode.tasksQueue.k).toBe(6) + expect(clusterWorkerNode.tasksQueue.bucketSize).toBe(6) expect(clusterWorkerNode.tasksQueueSize()).toBe( clusterWorkerNode.tasksQueue.size ) - expect(clusterWorkerNode.onBackPressureStarted).toBe(false) + expect(clusterWorkerNode.setBackPressureFlag).toBe(false) expect(clusterWorkerNode.taskFunctionsUsage).toBeInstanceOf(Map) }) @@ -312,17 +314,17 @@ describe('Worker node test suite', () => { failed: 0 }, runTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, waitTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, elu: { idle: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, active: { - history: new CircularArray() + history: expect.any(CircularBuffer) } } }) @@ -336,17 +338,17 @@ describe('Worker node test suite', () => { failed: 0 }, runTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, waitTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, elu: { idle: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, active: { - history: new CircularArray() + history: expect.any(CircularBuffer) } } }) @@ -360,17 +362,17 @@ describe('Worker node test suite', () => { failed: 0 }, runTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, waitTime: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, elu: { idle: { - history: new CircularArray() + history: expect.any(CircularBuffer) }, active: { - history: new CircularArray() + history: expect.any(CircularBuffer) } } })