build(deps): bump poolifier
[poolifier.git] / tests / pools / selection-strategies / selection-strategies.test.js
index 8f09c5024b28e78342c4c6af029156ebff3b80e3..77713b6f03f20f8dc883cad07820b292a16d47de 100644 (file)
@@ -123,7 +123,7 @@ describe('Selection strategies test suite', () => {
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
-      dynamicWorkerUsage: true,
+      dynamicWorkerUsage: false,
       dynamicWorkerReady: true
     })
     await pool.destroy()
@@ -134,7 +134,7 @@ describe('Selection strategies test suite', () => {
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
-      dynamicWorkerUsage: true,
+      dynamicWorkerUsage: false,
       dynamicWorkerReady: true
     })
     // We need to clean up the resources after our test
@@ -217,6 +217,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {
@@ -261,10 +262,11 @@ describe('Selection strategies test suite', () => {
     for (const workerNode of pool.workerNodes) {
       expect(workerNode.usage).toStrictEqual({
         tasks: {
-          executed: maxMultiplier,
+          executed: expect.any(Number),
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {
@@ -282,6 +284,10 @@ describe('Selection strategies test suite', () => {
           }
         }
       })
+      expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
+      expect(workerNode.usage.tasks.executed).toBeLessThanOrEqual(
+        max * maxMultiplier
+      )
     }
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
@@ -460,6 +466,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {
@@ -507,6 +514,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {
@@ -635,6 +643,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {
@@ -692,6 +701,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {
@@ -830,6 +840,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {
@@ -839,12 +850,12 @@ describe('Selection strategies test suite', () => {
           history: expect.any(CircularArray)
         },
         elu: {
-          idle: expect.objectContaining({
+          idle: {
             history: expect.any(CircularArray)
-          }),
-          active: expect.objectContaining({
+          },
+          active: {
             history: expect.any(CircularArray)
-          })
+          }
         }
       })
       expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
@@ -883,6 +894,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {
@@ -892,12 +904,12 @@ describe('Selection strategies test suite', () => {
           history: expect.any(CircularArray)
         },
         elu: {
-          idle: expect.objectContaining({
+          idle: {
             history: expect.any(CircularArray)
-          }),
-          active: expect.objectContaining({
+          },
+          active: {
             history: expect.any(CircularArray)
-          })
+          }
         }
       })
       expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
@@ -1017,21 +1029,22 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
-        runTime: expect.objectContaining({
+        runTime: {
           history: expect.any(CircularArray)
-        }),
+        },
         waitTime: {
           history: expect.any(CircularArray)
         },
         elu: {
-          idle: expect.objectContaining({
+          idle: {
             history: expect.any(CircularArray)
-          }),
-          active: expect.objectContaining({
+          },
+          active: {
             history: expect.any(CircularArray)
-          })
+          }
         }
       })
       expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
@@ -1085,21 +1098,22 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
-        runTime: expect.objectContaining({
+        runTime: {
           history: expect.any(CircularArray)
-        }),
+        },
         waitTime: {
           history: expect.any(CircularArray)
         },
         elu: {
-          idle: expect.objectContaining({
+          idle: {
             history: expect.any(CircularArray)
-          }),
-          active: expect.objectContaining({
+          },
+          active: {
             history: expect.any(CircularArray)
-          })
+          }
         }
       })
       expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
@@ -1158,21 +1172,22 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
-        runTime: expect.objectContaining({
+        runTime: {
           history: expect.any(CircularArray)
-        }),
+        },
         waitTime: {
           history: expect.any(CircularArray)
         },
         elu: {
-          idle: expect.objectContaining({
+          idle: {
             history: expect.any(CircularArray)
-          }),
-          active: expect.objectContaining({
+          },
+          active: {
             history: expect.any(CircularArray)
-          })
+          }
         }
       })
       expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
@@ -1381,6 +1396,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: expect.objectContaining({
@@ -1448,6 +1464,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: expect.objectContaining({
@@ -1520,6 +1537,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: expect.objectContaining({
@@ -1751,6 +1769,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {
@@ -1821,6 +1840,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          stolen: 0,
           failed: 0
         },
         runTime: {