fix: fix build after merge with main
[poolifier.git] / tests / pools / selection-strategies / selection-strategies.test.js
index f5d41cc89927d1e7468273daa2fa4e80c87c8b73..24a35810bb3d3327b07cf48b38317dfba9b51a20 100644 (file)
@@ -5,6 +5,7 @@ const {
   FixedThreadPool,
   FixedClusterPool
 } = require('../../../lib')
+const { CircularArray } = require('../../../lib/circular-array')
 
 describe('Selection strategies test suite', () => {
   const min = 0
@@ -12,12 +13,16 @@ describe('Selection strategies test suite', () => {
 
   it('Verify that WorkerChoiceStrategies enumeration provides string values', () => {
     expect(WorkerChoiceStrategies.ROUND_ROBIN).toBe('ROUND_ROBIN')
-    expect(WorkerChoiceStrategies.LESS_USED).toBe('LESS_USED')
-    expect(WorkerChoiceStrategies.LESS_BUSY).toBe('LESS_BUSY')
+    expect(WorkerChoiceStrategies.LEAST_USED).toBe('LEAST_USED')
+    expect(WorkerChoiceStrategies.LEAST_ELU).toBe('LEAST_ELU')
+    expect(WorkerChoiceStrategies.LEAST_BUSY).toBe('LEAST_BUSY')
     expect(WorkerChoiceStrategies.FAIR_SHARE).toBe('FAIR_SHARE')
     expect(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN).toBe(
       'WEIGHTED_ROUND_ROBIN'
     )
+    expect(WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN).toBe(
+      'INTERLEAVED_WEIGHTED_ROUND_ROBIN'
+    )
   })
 
   it('Verify ROUND_ROBIN strategy is the default at pool creation', async () => {
@@ -77,20 +82,16 @@ describe('Selection strategies test suite', () => {
           ).nextWorkerNodeId
         ).toBe(0)
       } else if (workerChoiceStrategy === WorkerChoiceStrategies.FAIR_SHARE) {
-        for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
-          .get(workerChoiceStrategy)
-          .workerLastVirtualTaskTimestamp.keys()) {
-          expect(
-            pool.workerChoiceStrategyContext.workerChoiceStrategies
-              .get(workerChoiceStrategy)
-              .workerLastVirtualTaskTimestamp.get(workerNodeKey).start
-          ).toBe(0)
-          expect(
-            pool.workerChoiceStrategyContext.workerChoiceStrategies
-              .get(workerChoiceStrategy)
-              .workerLastVirtualTaskTimestamp.get(workerNodeKey).end
-          ).toBe(0)
-        }
+        expect(
+          pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+            workerChoiceStrategy
+          ).workersVirtualTaskEndTimestamp
+        ).toBeInstanceOf(Array)
+        expect(
+          pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+            workerChoiceStrategy
+          ).workersVirtualTaskEndTimestamp.length
+        ).toBe(0)
       } else if (
         workerChoiceStrategy === WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
       ) {
@@ -104,20 +105,11 @@ describe('Selection strategies test suite', () => {
             workerChoiceStrategy
           ).defaultWorkerWeight
         ).toBeGreaterThan(0)
-        for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
-          .get(workerChoiceStrategy)
-          .workersTaskRunTime.keys()) {
-          expect(
-            pool.workerChoiceStrategyContext.workerChoiceStrategies
-              .get(workerChoiceStrategy)
-              .workersTaskRunTime.get(workerNodeKey).weight
-          ).toBeGreaterThan(0)
-          expect(
-            pool.workerChoiceStrategyContext.workerChoiceStrategies
-              .get(workerChoiceStrategy)
-              .workersTaskRunTime.get(workerNodeKey).runTime
-          ).toBe(0)
-        }
+        expect(
+          pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+            workerChoiceStrategy
+          ).workerVirtualTaskRunTime
+        ).toBe(0)
       }
     }
     await pool.destroy()
@@ -130,15 +122,15 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: false,
+      avgRunTime: false,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     await pool.destroy()
     pool = new DynamicThreadPool(
       min,
@@ -146,15 +138,15 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: false,
+      avgRunTime: false,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -166,12 +158,40 @@ describe('Selection strategies test suite', () => {
       { workerChoiceStrategy: WorkerChoiceStrategies.ROUND_ROBIN }
     )
     // TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose`
-    const promises = []
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: maxMultiplier,
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        WorkerChoiceStrategies.ROUND_ROBIN
+      ).nextWorkerNodeId
+    ).toBe(0)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -184,12 +204,40 @@ describe('Selection strategies test suite', () => {
       { workerChoiceStrategy: WorkerChoiceStrategies.ROUND_ROBIN }
     )
     // TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose`
-    const promises = []
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: maxMultiplier,
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        WorkerChoiceStrategies.ROUND_ROBIN
+      ).nextWorkerNodeId
+    ).toBe(0)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -203,7 +251,7 @@ describe('Selection strategies test suite', () => {
     )
     let results = new Set()
     for (let i = 0; i < max; i++) {
-      results.add(pool.chooseWorkerNode()[1].worker.id)
+      results.add(pool.workerNodes[pool.chooseWorkerNode()].worker.id)
     }
     expect(results.size).toBe(max)
     await pool.destroy()
@@ -214,7 +262,7 @@ describe('Selection strategies test suite', () => {
     )
     results = new Set()
     for (let i = 0; i < max; i++) {
-      results.add(pool.chooseWorkerNode()[1].worker.threadId)
+      results.add(pool.workerNodes[pool.chooseWorkerNode()].worker.threadId)
     }
     expect(results.size).toBe(max)
     await pool.destroy()
@@ -260,22 +308,22 @@ describe('Selection strategies test suite', () => {
     await pool.destroy()
   })
 
-  it('Verify LESS_USED strategy default tasks usage statistics requirements', async () => {
-    const workerChoiceStrategy = WorkerChoiceStrategies.LESS_USED
+  it('Verify LEAST_USED strategy default tasks usage statistics requirements', async () => {
+    const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_USED
     let pool = new FixedThreadPool(
       max,
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: false,
+      avgRunTime: false,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     await pool.destroy()
     pool = new DynamicThreadPool(
       min,
@@ -283,70 +331,117 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: false,
+      avgRunTime: false,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     // We need to clean up the resources after our test
     await pool.destroy()
   })
 
-  it('Verify LESS_USED strategy can be run in a fixed pool', async () => {
+  it('Verify LEAST_USED strategy can be run in a fixed pool', async () => {
     const pool = new FixedThreadPool(
       max,
       './tests/worker-files/thread/testWorker.js',
-      { workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED }
+      { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED }
     )
-    // TODO: Create a better test to cover `LessUsedWorkerChoiceStrategy#choose`
-    const promises = []
+    // TODO: Create a better test to cover `LeastUsedWorkerChoiceStrategy#choose`
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: maxMultiplier,
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+    }
     // We need to clean up the resources after our test
     await pool.destroy()
   })
 
-  it('Verify LESS_USED strategy can be run in a dynamic pool', async () => {
+  it('Verify LEAST_USED strategy can be run in a dynamic pool', async () => {
     const pool = new DynamicThreadPool(
       min,
       max,
       './tests/worker-files/thread/testWorker.js',
-      { workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED }
+      { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED }
     )
-    // TODO: Create a better test to cover `LessUsedWorkerChoiceStrategy#choose`
-    const promises = []
+    // TODO: Create a better test to cover `LeastUsedWorkerChoiceStrategy#choose`
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: maxMultiplier,
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+
+        elu: undefined
+      })
+    }
     // We need to clean up the resources after our test
     await pool.destroy()
   })
 
-  it('Verify LESS_BUSY strategy default tasks usage statistics requirements', async () => {
-    const workerChoiceStrategy = WorkerChoiceStrategies.LESS_BUSY
+  it('Verify LEAST_BUSY strategy default tasks usage statistics requirements', async () => {
+    const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_BUSY
     let pool = new FixedThreadPool(
       max,
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: true,
+      avgRunTime: false,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     await pool.destroy()
     pool = new DynamicThreadPool(
       min,
@@ -354,50 +449,108 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(false)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: true,
+      avgRunTime: false,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     // We need to clean up the resources after our test
     await pool.destroy()
   })
 
-  it('Verify LESS_BUSY strategy can be run in a fixed pool', async () => {
+  it('Verify LEAST_BUSY strategy can be run in a fixed pool', async () => {
     const pool = new FixedThreadPool(
       max,
       './tests/worker-files/thread/testWorker.js',
-      { workerChoiceStrategy: WorkerChoiceStrategies.LESS_BUSY }
+      { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_BUSY }
     )
-    // TODO: Create a better test to cover `LessBusyWorkerChoiceStrategy#choose`
-    const promises = []
+    // TODO: Create a better test to cover `LeastBusyWorkerChoiceStrategy#choose`
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: expect.any(Number),
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: expect.any(Number),
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+      expect(workerNode.workerUsage.tasks.executed).toBeGreaterThanOrEqual(0)
+      expect(workerNode.workerUsage.tasks.executed).toBeLessThanOrEqual(
+        max * maxMultiplier
+      )
+      expect(workerNode.workerUsage.runTime.aggregation).toBeGreaterThanOrEqual(
+        0
+      )
+    }
     // We need to clean up the resources after our test
     await pool.destroy()
   })
 
-  it('Verify LESS_BUSY strategy can be run in a dynamic pool', async () => {
+  it('Verify LEAST_BUSY strategy can be run in a dynamic pool', async () => {
     const pool = new DynamicThreadPool(
       min,
       max,
       './tests/worker-files/thread/testWorker.js',
-      { workerChoiceStrategy: WorkerChoiceStrategies.LESS_BUSY }
+      { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_BUSY }
     )
-    // TODO: Create a better test to cover `LessBusyWorkerChoiceStrategy#choose`
-    const promises = []
+    // TODO: Create a better test to cover `LeastBusyWorkerChoiceStrategy#choose`
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: expect.any(Number),
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: expect.any(Number),
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+      expect(workerNode.workerUsage.tasks.executed).toBeGreaterThan(0)
+      expect(workerNode.workerUsage.tasks.executed).toBeLessThanOrEqual(
+        max * maxMultiplier
+      )
+      expect(workerNode.workerUsage.runTime.aggregation).toBeGreaterThan(0)
+    }
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -409,15 +562,15 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: true,
+      avgRunTime: true,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     await pool.destroy()
     pool = new DynamicThreadPool(
       min,
@@ -425,15 +578,15 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: true,
+      avgRunTime: true,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -445,16 +598,41 @@ describe('Selection strategies test suite', () => {
       { workerChoiceStrategy: WorkerChoiceStrategies.FAIR_SHARE }
     )
     // TODO: Create a better test to cover `FairShareChoiceStrategy#choose`
-    const promises = []
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: maxMultiplier,
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: expect.any(Number),
+          average: expect.any(Number),
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+      expect(workerNode.workerUsage.runTime.aggregation).toBeGreaterThan(0)
+      expect(workerNode.workerUsage.runTime.average).toBeGreaterThan(0)
+    }
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).workerLastVirtualTaskTimestamp.size
+      ).workersVirtualTaskEndTimestamp.length
     ).toBe(pool.workerNodes.length)
     // We need to clean up the resources after our test
     await pool.destroy()
@@ -468,24 +646,47 @@ describe('Selection strategies test suite', () => {
       { workerChoiceStrategy: WorkerChoiceStrategies.FAIR_SHARE }
     )
     // TODO: Create a better test to cover `FairShareChoiceStrategy#choose`
-    const promises = []
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
-    // if (process.platform !== 'win32') {
-    //   expect(
-    //     pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-    //       pool.workerChoiceStrategyContext.workerChoiceStrategy
-    //     ).workerLastVirtualTaskTimestamp.size
-    //   ).toBe(pool.workerNodes.length)
-    // }
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: maxMultiplier,
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: expect.any(Number),
+          average: expect.any(Number),
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+      expect(workerNode.workerUsage.runTime.aggregation).toBeGreaterThan(0)
+      expect(workerNode.workerUsage.runTime.average).toBeGreaterThan(0)
+    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp.length
+    ).toBe(pool.workerNodes.length)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
 
-  it('Verify FAIR_SHARE strategy can be run in a dynamic pool with median run time statistic', async () => {
+  it('Verify FAIR_SHARE strategy can be run in a dynamic pool with median runtime statistic', async () => {
     const pool = new DynamicThreadPool(
       min,
       max,
@@ -498,25 +699,42 @@ describe('Selection strategies test suite', () => {
       }
     )
     // TODO: Create a better test to cover `FairShareChoiceStrategy#choose`
-    const promises = []
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
     for (const workerNode of pool.workerNodes) {
-      expect(workerNode.tasksUsage.avgRunTime).toBeDefined()
-      expect(workerNode.tasksUsage.avgRunTime).toBe(0)
-      expect(workerNode.tasksUsage.medRunTime).toBeDefined()
-      expect(workerNode.tasksUsage.medRunTime).toBeGreaterThan(0)
-    }
-    // if (process.platform !== 'win32') {
-    //   expect(
-    //     pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-    //       pool.workerChoiceStrategyContext.workerChoiceStrategy
-    //     ).workerLastVirtualTaskTimestamp.size
-    //   ).toBe(pool.workerNodes.length)
-    // }
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: maxMultiplier,
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: expect.any(Number),
+          average: 0,
+          median: expect.any(Number),
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+      expect(workerNode.workerUsage.runTime.aggregation).toBeGreaterThan(0)
+      expect(workerNode.workerUsage.runTime.median).toBeGreaterThan(0)
+    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp.length
+    ).toBe(pool.workerNodes.length)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -530,23 +748,32 @@ describe('Selection strategies test suite', () => {
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         workerChoiceStrategy
-      ).workerLastVirtualTaskTimestamp
-    ).toBeDefined()
+      ).workersVirtualTaskEndTimestamp
+    ).toBeInstanceOf(Array)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp.length
+    ).toBe(0)
+    pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+      workerChoiceStrategy
+    ).workersVirtualTaskEndTimestamp[0] = performance.now()
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp.length
+    ).toBe(1)
     pool.setWorkerChoiceStrategy(workerChoiceStrategy)
-    for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
-      .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-      .workerLastVirtualTaskTimestamp.keys()) {
-      expect(
-        pool.workerChoiceStrategyContext.workerChoiceStrategies
-          .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-          .workerLastVirtualTaskTimestamp.get(workerNodeKey).start
-      ).toBe(0)
-      expect(
-        pool.workerChoiceStrategyContext.workerChoiceStrategies
-          .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-          .workerLastVirtualTaskTimestamp.get(workerNodeKey).end
-      ).toBe(0)
-    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp
+    ).toBeInstanceOf(Array)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp.length
+    ).toBe(0)
     await pool.destroy()
     pool = new DynamicThreadPool(
       min,
@@ -556,23 +783,32 @@ describe('Selection strategies test suite', () => {
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         workerChoiceStrategy
-      ).workerLastVirtualTaskTimestamp
-    ).toBeDefined()
+      ).workersVirtualTaskEndTimestamp
+    ).toBeInstanceOf(Array)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp.length
+    ).toBe(0)
+    pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+      workerChoiceStrategy
+    ).workersVirtualTaskEndTimestamp[0] = performance.now()
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp.length
+    ).toBe(1)
     pool.setWorkerChoiceStrategy(workerChoiceStrategy)
-    for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
-      .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-      .workerLastVirtualTaskTimestamp.keys()) {
-      expect(
-        pool.workerChoiceStrategyContext.workerChoiceStrategies
-          .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-          .workerLastVirtualTaskTimestamp.get(workerNodeKey).start
-      ).toBe(0)
-      expect(
-        pool.workerChoiceStrategyContext.workerChoiceStrategies
-          .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-          .workerLastVirtualTaskTimestamp.get(workerNodeKey).end
-      ).toBe(0)
-    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp
+    ).toBeInstanceOf(Array)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workersVirtualTaskEndTimestamp.length
+    ).toBe(0)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -584,15 +820,15 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: true,
+      avgRunTime: true,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     await pool.destroy()
     pool = new DynamicThreadPool(
       min,
@@ -600,15 +836,15 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().runTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime
-    ).toBe(true)
-    expect(
-      pool.workerChoiceStrategyContext.getRequiredStatistics().medRunTime
-    ).toBe(false)
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: true,
+      avgRunTime: true,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -620,17 +856,53 @@ describe('Selection strategies test suite', () => {
       { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
     )
     // TODO: Create a better test to cover `WeightedRoundRobinWorkerChoiceStrategy#choose`
-    const promises = []
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: expect.any(Number),
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: expect.any(Number),
+          average: expect.any(Number),
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+      expect(workerNode.workerUsage.tasks.executed).toBeGreaterThanOrEqual(0)
+      expect(workerNode.workerUsage.tasks.executed).toBeLessThanOrEqual(
+        max * maxMultiplier
+      )
+      expect(workerNode.workerUsage.runTime.aggregation).toBeGreaterThanOrEqual(
+        0
+      )
+      expect(workerNode.workerUsage.runTime.average).toBeGreaterThanOrEqual(0)
+    }
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).workersTaskRunTime.size
-    ).toBe(pool.workerNodes.length)
+      ).defaultWorkerWeight
+    ).toBeGreaterThan(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).workerVirtualTaskRunTime
+    ).toBeGreaterThanOrEqual(0)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -643,27 +915,56 @@ describe('Selection strategies test suite', () => {
       { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
     )
     // TODO: Create a better test to cover `WeightedRoundRobinWorkerChoiceStrategy#choose`
-    const promises = []
-    const maxMultiplier =
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight * 50
+    const promises = new Set()
+    const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
-    if (process.platform !== 'win32') {
-      expect(
-        pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-          pool.workerChoiceStrategyContext.workerChoiceStrategy
-        ).workersTaskRunTime.size
-      ).toBe(pool.workerNodes.length)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: expect.any(Number),
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: expect.any(Number),
+          average: expect.any(Number),
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+      expect(workerNode.workerUsage.tasks.executed).toBeGreaterThan(0)
+      expect(workerNode.workerUsage.tasks.executed).toBeLessThanOrEqual(
+        max * maxMultiplier
+      )
+      expect(workerNode.workerUsage.runTime.aggregation).toBeGreaterThan(0)
+      expect(workerNode.workerUsage.runTime.average).toBeGreaterThan(0)
     }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ).toBeGreaterThan(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).workerVirtualTaskRunTime
+    ).toBeGreaterThanOrEqual(0)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
 
-  it('Verify WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool with median run time statistic', async () => {
+  it('Verify WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool with median runtime statistic', async () => {
     const pool = new DynamicThreadPool(
       min,
       max,
@@ -676,25 +977,51 @@ describe('Selection strategies test suite', () => {
       }
     )
     // TODO: Create a better test to cover `WeightedRoundRobinWorkerChoiceStrategy#choose`
-    const promises = []
+    const promises = new Set()
     const maxMultiplier = 2
     for (let i = 0; i < max * maxMultiplier; i++) {
-      promises.push(pool.execute())
+      promises.add(pool.execute())
     }
     await Promise.all(promises)
     for (const workerNode of pool.workerNodes) {
-      expect(workerNode.tasksUsage.avgRunTime).toBeDefined()
-      expect(workerNode.tasksUsage.avgRunTime).toBe(0)
-      expect(workerNode.tasksUsage.medRunTime).toBeDefined()
-      expect(workerNode.tasksUsage.medRunTime).toBeGreaterThan(0)
-    }
-    // if (process.platform !== 'win32') {
-    //   expect(
-    //     pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-    //       pool.workerChoiceStrategyContext.workerChoiceStrategy
-    //     ).workersTaskRunTime.size
-    //   ).toBe(pool.workerNodes.length)
-    // }
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: expect.any(Number),
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: expect.any(Number),
+          average: 0,
+          median: expect.any(Number),
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+      expect(workerNode.workerUsage.tasks.executed).toBeGreaterThan(0)
+      expect(workerNode.workerUsage.tasks.executed).toBeLessThanOrEqual(
+        max * maxMultiplier
+      )
+      expect(workerNode.workerUsage.runTime.aggregation).toBeGreaterThan(0)
+      expect(workerNode.workerUsage.runTime.median).toBeGreaterThan(0)
+    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ).toBeGreaterThan(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).workerVirtualTaskRunTime
+    ).toBeGreaterThanOrEqual(0)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -718,7 +1045,7 @@ describe('Selection strategies test suite', () => {
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         workerChoiceStrategy
-      ).workersTaskRunTime
+      ).workerVirtualTaskRunTime
     ).toBeDefined()
     pool.setWorkerChoiceStrategy(workerChoiceStrategy)
     expect(
@@ -731,15 +1058,11 @@ describe('Selection strategies test suite', () => {
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).defaultWorkerWeight
     ).toBeGreaterThan(0)
-    for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
-      .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-      .workersTaskRunTime.keys()) {
-      expect(
-        pool.workerChoiceStrategyContext.workerChoiceStrategies
-          .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-          .workersTaskRunTime.get(workerNodeKey).runTime
-      ).toBe(0)
-    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workerVirtualTaskRunTime
+    ).toBe(0)
     await pool.destroy()
     pool = new DynamicThreadPool(
       min,
@@ -759,7 +1082,7 @@ describe('Selection strategies test suite', () => {
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         workerChoiceStrategy
-      ).workersTaskRunTime
+      ).workerVirtualTaskRunTime
     ).toBeDefined()
     pool.setWorkerChoiceStrategy(workerChoiceStrategy)
     expect(
@@ -772,15 +1095,285 @@ describe('Selection strategies test suite', () => {
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).defaultWorkerWeight
     ).toBeGreaterThan(0)
-    for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
-      .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-      .workersTaskRunTime.keys()) {
-      expect(
-        pool.workerChoiceStrategyContext.workerChoiceStrategies
-          .get(pool.workerChoiceStrategyContext.workerChoiceStrategy)
-          .workersTaskRunTime.get(workerNodeKey).runTime
-      ).toBe(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).workerVirtualTaskRunTime
+    ).toBe(0)
+    // We need to clean up the resources after our test
+    await pool.destroy()
+  })
+
+  it('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy default tasks usage statistics requirements', async () => {
+    const workerChoiceStrategy =
+      WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
+    let pool = new FixedThreadPool(
+      max,
+      './tests/worker-files/thread/testWorker.js',
+      { workerChoiceStrategy }
+    )
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: false,
+      avgRunTime: false,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
+    await pool.destroy()
+    pool = new DynamicThreadPool(
+      min,
+      max,
+      './tests/worker-files/thread/testWorker.js',
+      { workerChoiceStrategy }
+    )
+    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+      runTime: false,
+      avgRunTime: false,
+      medRunTime: false,
+      waitTime: false,
+      avgWaitTime: false,
+      medWaitTime: false,
+      elu: false
+    })
+    // We need to clean up the resources after our test
+    await pool.destroy()
+  })
+
+  it('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a fixed pool', async () => {
+    const pool = new FixedThreadPool(
+      max,
+      './tests/worker-files/thread/testWorker.js',
+      {
+        workerChoiceStrategy:
+          WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
+      }
+    )
+    // TODO: Create a better test to cover `InterleavedWeightedRoundRobinWorkerChoiceStrategy#choose`
+    const promises = new Set()
+    const maxMultiplier = 2
+    for (let i = 0; i < max * maxMultiplier; i++) {
+      promises.add(pool.execute())
     }
+    await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: maxMultiplier,
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ).toBeGreaterThan(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).currentRoundId
+    ).toBe(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).currentWorkerNodeId
+    ).toBe(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).roundWeights
+    ).toStrictEqual([
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ])
+    // We need to clean up the resources after our test
+    await pool.destroy()
+  })
+
+  it('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool', async () => {
+    const pool = new DynamicThreadPool(
+      min,
+      max,
+      './tests/worker-files/thread/testWorker.js',
+      {
+        workerChoiceStrategy:
+          WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
+      }
+    )
+    // TODO: Create a better test to cover `InterleavedWeightedRoundRobinWorkerChoiceStrategy#choose`
+    const promises = new Set()
+    const maxMultiplier = 2
+    for (let i = 0; i < max * maxMultiplier; i++) {
+      promises.add(pool.execute())
+    }
+    await Promise.all(promises)
+    for (const workerNode of pool.workerNodes) {
+      expect(workerNode.workerUsage).toStrictEqual({
+        tasks: {
+          executed: maxMultiplier,
+          executing: 0,
+          queued: 0,
+          failed: 0
+        },
+        runTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        waitTime: {
+          aggregation: 0,
+          average: 0,
+          median: 0,
+          history: expect.any(CircularArray)
+        },
+        elu: undefined
+      })
+    }
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ).toBeGreaterThan(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).currentRoundId
+    ).toBe(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).currentWorkerNodeId
+    ).toBe(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).roundWeights
+    ).toStrictEqual([
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ])
+    // We need to clean up the resources after our test
+    await pool.destroy()
+  })
+
+  it('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy internals are resets after setting it', async () => {
+    const workerChoiceStrategy =
+      WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
+    let pool = new FixedThreadPool(
+      max,
+      './tests/worker-files/thread/testWorker.js'
+    )
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).currentRoundId
+    ).toBeDefined()
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).currentWorkerNodeId
+    ).toBeDefined()
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).defaultWorkerWeight
+    ).toBeDefined()
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).roundWeights
+    ).toBeDefined()
+    pool.setWorkerChoiceStrategy(workerChoiceStrategy)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).currentRoundId
+    ).toBe(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).currentWorkerNodeId
+    ).toBe(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ).toBeGreaterThan(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).roundWeights
+    ).toStrictEqual([
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ])
+    await pool.destroy()
+    pool = new DynamicThreadPool(
+      min,
+      max,
+      './tests/worker-files/thread/testWorker.js'
+    )
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).currentRoundId
+    ).toBeDefined()
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).currentWorkerNodeId
+    ).toBeDefined()
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).defaultWorkerWeight
+    ).toBeDefined()
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).roundWeights
+    ).toBeDefined()
+    pool.setWorkerChoiceStrategy(workerChoiceStrategy)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).currentWorkerNodeId
+    ).toBe(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ).toBeGreaterThan(0)
+    expect(
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        workerChoiceStrategy
+      ).roundWeights
+    ).toStrictEqual([
+      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+        pool.workerChoiceStrategyContext.workerChoiceStrategy
+      ).defaultWorkerWeight
+    ])
     // We need to clean up the resources after our test
     await pool.destroy()
   })