X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fpools%2Fabstract%2Fabstract-pool.test.js;h=933e1f944f863bdbcdb4110c1d75359e8f571b4c;hb=68cbdc846878bc058323b757a68b4c83eedc6388;hp=812509513bffee46808b739d1fb7422e8c8eb3b7;hpb=c74b6981dbc78aa19a73c690eace221969bb997f;p=poolifier.git diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index 81250951..933e1f94 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -23,6 +23,10 @@ describe('Abstract pool test suite', () => { } } + afterEach(() => { + sinon.restore() + }) + it('Simulate pool creation from a non main thread/process', () => { expect( () => @@ -614,6 +618,7 @@ describe('Abstract pool test suite', () => { executing: 0, queued: 0, maxQueued: 0, + stolen: 0, failed: 0 }, runTime: { @@ -706,6 +711,7 @@ describe('Abstract pool test suite', () => { executing: maxMultiplier, queued: 0, maxQueued: 0, + stolen: 0, failed: 0 }, runTime: { @@ -732,6 +738,7 @@ describe('Abstract pool test suite', () => { executing: 0, queued: 0, maxQueued: 0, + stolen: 0, failed: 0 }, runTime: { @@ -772,6 +779,7 @@ describe('Abstract pool test suite', () => { executing: 0, queued: 0, maxQueued: 0, + stolen: 0, failed: 0 }, runTime: { @@ -806,6 +814,7 @@ describe('Abstract pool test suite', () => { executing: 0, queued: 0, maxQueued: 0, + stolen: 0, failed: 0 }, runTime: { @@ -952,11 +961,11 @@ describe('Abstract pool test suite', () => { ++poolBackPressure poolInfo = info }) - for (let i = 0; i < numberOfWorkers * 2; i++) { + for (let i = 0; i < numberOfWorkers + 1; i++) { promises.add(pool.execute()) } await Promise.all(promises) - expect(poolBackPressure).toBe(2) + expect(poolBackPressure).toBe(1) expect(poolInfo).toStrictEqual({ version, type: PoolTypes.fixed, @@ -973,6 +982,7 @@ describe('Abstract pool test suite', () => { maxQueuedTasks: expect.any(Number), queuedTasks: expect.any(Number), backPressure: true, + stolenTasks: expect.any(Number), failedTasks: expect.any(Number) }) expect(pool.hasBackPressure.called).toBe(true) @@ -1036,7 +1046,8 @@ describe('Abstract pool test suite', () => { executed: expect.any(Number), executing: expect.any(Number), failed: 0, - queued: 0 + queued: 0, + stolen: 0 }, runTime: { history: expect.any(CircularArray)