fix: fix type namespace collision
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 8 Jun 2023 17:54:34 +0000 (19:54 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 8 Jun 2023 17:54:34 +0000 (19:54 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/index.ts
src/pools/abstract-pool.ts
src/pools/selection-strategies/abstract-worker-choice-strategy.ts
src/pools/selection-strategies/fair-share-worker-choice-strategy.ts
src/pools/selection-strategies/least-busy-worker-choice-strategy.ts
src/pools/selection-strategies/selection-strategies-types.ts
src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
src/pools/selection-strategies/worker-choice-strategy-context.ts
tests/pools/abstract/abstract-pool.test.js
tests/pools/selection-strategies/selection-strategies.test.js
tests/pools/selection-strategies/worker-choice-strategy-context.test.js

index df1ca536a063a8a1412fb3f1dfe78ad7bf2cfc0e..55355d2e33bc6dbf01e31eca234cbcb56c0a78ad 100644 (file)
@@ -19,16 +19,18 @@ export type {
   ErrorHandler,
   ExitHandler,
   IWorker,
+  MeasurementStatistics,
   MessageHandler,
   OnlineHandler,
   Task,
-  WorkerUsage,
-  WorkerNode
+  TaskStatistics,
+  WorkerNode,
+  WorkerUsage
 } from './pools/worker'
 export { WorkerChoiceStrategies } from './pools/selection-strategies/selection-strategies-types'
 export type {
   IWorkerChoiceStrategy,
-  TaskStatistics,
+  TaskStatisticsRequirements,
   WorkerChoiceStrategy,
   WorkerChoiceStrategyOptions
 } from './pools/selection-strategies/selection-strategies-types'
@@ -54,6 +56,7 @@ export type {
   Draft,
   MessageValue,
   PromiseResponseWrapper,
+  TaskError,
   TaskPerformance,
   WorkerStatistics
 } from './utility-types'
index e4947cdc6b6caeca4c77d485d8b15d83c3591272..e941fabb772690f0797c204226430f113ea97d43 100644 (file)
@@ -514,17 +514,21 @@ export abstract class AbstractPool<
     workerUsage: WorkerUsage,
     message: MessageValue<Response>
   ): void {
-    if (this.workerChoiceStrategyContext.getTaskStatistics().runTime) {
+    if (
+      this.workerChoiceStrategyContext.getTaskStatisticsRequirements().runTime
+    ) {
       workerUsage.runTime.aggregation += message.taskPerformance?.runTime ?? 0
       if (
-        this.workerChoiceStrategyContext.getTaskStatistics().avgRunTime &&
+        this.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+          .avgRunTime &&
         workerUsage.tasks.executed !== 0
       ) {
         workerUsage.runTime.average =
           workerUsage.runTime.aggregation / workerUsage.tasks.executed
       }
       if (
-        this.workerChoiceStrategyContext.getTaskStatistics().medRunTime &&
+        this.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+          .medRunTime &&
         message.taskPerformance?.runTime != null
       ) {
         workerUsage.runTime.history.push(message.taskPerformance.runTime)
@@ -537,17 +541,21 @@ export abstract class AbstractPool<
     workerUsage: WorkerUsage,
     message: MessageValue<Response>
   ): void {
-    if (this.workerChoiceStrategyContext.getTaskStatistics().waitTime) {
+    if (
+      this.workerChoiceStrategyContext.getTaskStatisticsRequirements().waitTime
+    ) {
       workerUsage.waitTime.aggregation += message.taskPerformance?.waitTime ?? 0
       if (
-        this.workerChoiceStrategyContext.getTaskStatistics().avgWaitTime &&
+        this.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+          .avgWaitTime &&
         workerUsage.tasks.executed !== 0
       ) {
         workerUsage.waitTime.average =
           workerUsage.waitTime.aggregation / workerUsage.tasks.executed
       }
       if (
-        this.workerChoiceStrategyContext.getTaskStatistics().medWaitTime &&
+        this.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+          .medWaitTime &&
         message.taskPerformance?.waitTime != null
       ) {
         workerUsage.waitTime.history.push(message.taskPerformance.waitTime)
@@ -560,7 +568,7 @@ export abstract class AbstractPool<
     workerTasksUsage: WorkerUsage,
     message: MessageValue<Response>
   ): void {
-    if (this.workerChoiceStrategyContext.getTaskStatistics().elu) {
+    if (this.workerChoiceStrategyContext.getTaskStatisticsRequirements().elu) {
       if (
         workerTasksUsage.elu != null &&
         message.taskPerformance?.elu != null
@@ -848,9 +856,14 @@ export abstract class AbstractPool<
   private setWorkerStatistics (worker: Worker): void {
     this.sendToWorker(worker, {
       statistics: {
-        runTime: this.workerChoiceStrategyContext.getTaskStatistics().runTime,
-        waitTime: this.workerChoiceStrategyContext.getTaskStatistics().waitTime,
-        elu: this.workerChoiceStrategyContext.getTaskStatistics().elu
+        runTime:
+          this.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+            .runTime,
+        waitTime:
+          this.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+            .waitTime,
+        elu: this.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+          .elu
       }
     })
   }
index f064c2e0838e0a68b1a809648c457308cf107eb4..b5b77ff6e261519d2bbef3154ca701e059d77a16 100644 (file)
@@ -4,7 +4,7 @@ import type { IPool } from '../pool'
 import type { IWorker } from '../worker'
 import type {
   IWorkerChoiceStrategy,
-  TaskStatistics,
+  TaskStatisticsRequirements,
   WorkerChoiceStrategyOptions
 } from './selection-strategies-types'
 
@@ -25,7 +25,7 @@ export abstract class AbstractWorkerChoiceStrategy<
    */
   private toggleFindLastFreeWorkerNodeKey: boolean = false
   /** @inheritDoc */
-  public readonly taskStatistics: TaskStatistics = {
+  public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
     runTime: false,
     avgRunTime: false,
     medRunTime: false,
@@ -49,21 +49,33 @@ export abstract class AbstractWorkerChoiceStrategy<
   }
 
   protected setTaskStatistics (opts: WorkerChoiceStrategyOptions): void {
-    if (this.taskStatistics.avgRunTime && opts.medRunTime === true) {
-      this.taskStatistics.avgRunTime = false
-      this.taskStatistics.medRunTime = opts.medRunTime as boolean
+    if (
+      this.taskStatisticsRequirements.avgRunTime &&
+      opts.medRunTime === true
+    ) {
+      this.taskStatisticsRequirements.avgRunTime = false
+      this.taskStatisticsRequirements.medRunTime = opts.medRunTime as boolean
     }
-    if (this.taskStatistics.medRunTime && opts.medRunTime === false) {
-      this.taskStatistics.avgRunTime = true
-      this.taskStatistics.medRunTime = opts.medRunTime as boolean
+    if (
+      this.taskStatisticsRequirements.medRunTime &&
+      opts.medRunTime === false
+    ) {
+      this.taskStatisticsRequirements.avgRunTime = true
+      this.taskStatisticsRequirements.medRunTime = opts.medRunTime as boolean
     }
-    if (this.taskStatistics.avgWaitTime && opts.medWaitTime === true) {
-      this.taskStatistics.avgWaitTime = false
-      this.taskStatistics.medWaitTime = opts.medWaitTime as boolean
+    if (
+      this.taskStatisticsRequirements.avgWaitTime &&
+      opts.medWaitTime === true
+    ) {
+      this.taskStatisticsRequirements.avgWaitTime = false
+      this.taskStatisticsRequirements.medWaitTime = opts.medWaitTime as boolean
     }
-    if (this.taskStatistics.medWaitTime && opts.medWaitTime === false) {
-      this.taskStatistics.avgWaitTime = true
-      this.taskStatistics.medWaitTime = opts.medWaitTime as boolean
+    if (
+      this.taskStatisticsRequirements.medWaitTime &&
+      opts.medWaitTime === false
+    ) {
+      this.taskStatisticsRequirements.avgWaitTime = true
+      this.taskStatisticsRequirements.medWaitTime = opts.medWaitTime as boolean
     }
   }
 
@@ -102,28 +114,28 @@ export abstract class AbstractWorkerChoiceStrategy<
 
   /**
    * Gets the worker task runtime.
-   * If the task statistics wants `avgRunTime`, the average runtime is returned.
-   * If the task statistics wants `medRunTime`, the median runtime is returned.
+   * If the task statistics require `avgRunTime`, the average runtime is returned.
+   * If the task statistics require `medRunTime`, the median runtime is returned.
    *
    * @param workerNodeKey - The worker node key.
    * @returns The worker task runtime.
    */
   protected getWorkerTaskRunTime (workerNodeKey: number): number {
-    return this.taskStatistics.medRunTime
+    return this.taskStatisticsRequirements.medRunTime
       ? this.pool.workerNodes[workerNodeKey].workerUsage.runTime.median
       : this.pool.workerNodes[workerNodeKey].workerUsage.runTime.average
   }
 
   /**
    * Gets the worker task wait time.
-   * If the task statistics wants `avgWaitTime`, the average wait time is returned.
-   * If the task statistics wants `medWaitTime`, the median wait time is returned.
+   * If the task statistics require `avgWaitTime`, the average wait time is returned.
+   * If the task statistics require `medWaitTime`, the median wait time is returned.
    *
    * @param workerNodeKey - The worker node key.
    * @returns The worker task wait time.
    */
   protected getWorkerWaitTime (workerNodeKey: number): number {
-    return this.taskStatistics.medWaitTime
+    return this.taskStatisticsRequirements.medWaitTime
       ? this.pool.workerNodes[workerNodeKey].workerUsage.runTime.median
       : this.pool.workerNodes[workerNodeKey].workerUsage.runTime.average
   }
index f6fdc4af462823981ad5e646974548b6acbb2951..4462f6dd509f0519d7ebe971749aba76df9d251d 100644 (file)
@@ -4,7 +4,7 @@ import type { IWorker } from '../worker'
 import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
 import type {
   IWorkerChoiceStrategy,
-  TaskStatistics,
+  TaskStatisticsRequirements,
   WorkerChoiceStrategyOptions
 } from './selection-strategies-types'
 
@@ -24,7 +24,7 @@ export class FairShareWorkerChoiceStrategy<
   extends AbstractWorkerChoiceStrategy<Worker, Data, Response>
   implements IWorkerChoiceStrategy {
   /** @inheritDoc */
-  public readonly taskStatistics: TaskStatistics = {
+  public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
     runTime: true,
     avgRunTime: true,
     medRunTime: false,
index de747089b8fc49d989ef232c442a6caf695a3e6d..f171ab5f50b1a90d7ed48550f96dbb4d42b5e015 100644 (file)
@@ -4,7 +4,7 @@ import type { IWorker } from '../worker'
 import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
 import type {
   IWorkerChoiceStrategy,
-  TaskStatistics,
+  TaskStatisticsRequirements,
   WorkerChoiceStrategyOptions
 } from './selection-strategies-types'
 
@@ -23,7 +23,7 @@ export class LeastBusyWorkerChoiceStrategy<
   extends AbstractWorkerChoiceStrategy<Worker, Data, Response>
   implements IWorkerChoiceStrategy {
   /** @inheritDoc */
-  public readonly taskStatistics: TaskStatistics = {
+  public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
     runTime: true,
     avgRunTime: false,
     medRunTime: false,
index 9bf28ac69c962e5203500bc6e3af5ae0d1c6ed25..5723bd67da6af4b765bcb0e163e48643d48a72e7 100644 (file)
@@ -65,7 +65,7 @@ export interface WorkerChoiceStrategyOptions {
  *
  * @internal
  */
-export interface TaskStatistics {
+export interface TaskStatisticsRequirements {
   /**
    * Require tasks runtime.
    */
@@ -101,9 +101,9 @@ export interface TaskStatistics {
  */
 export interface IWorkerChoiceStrategy {
   /**
-   * Required tasks statistics.
+   * Tasks statistics requirements.
    */
-  readonly taskStatistics: TaskStatistics
+  readonly taskStatisticsRequirements: TaskStatisticsRequirements
   /**
    * Resets strategy internals.
    *
index 729dbe66ad90e1a723b2e5bdb77e3c4a1d2b8341..75e278bc407d704069e946be11a899cdfadaf8a7 100644 (file)
@@ -4,7 +4,7 @@ import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
 import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
 import type {
   IWorkerChoiceStrategy,
-  TaskStatistics,
+  TaskStatisticsRequirements,
   WorkerChoiceStrategyOptions
 } from './selection-strategies-types'
 
@@ -24,7 +24,7 @@ export class WeightedRoundRobinWorkerChoiceStrategy<
   extends AbstractWorkerChoiceStrategy<Worker, Data, Response>
   implements IWorkerChoiceStrategy {
   /** @inheritDoc */
-  public readonly taskStatistics: TaskStatistics = {
+  public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
     runTime: true,
     avgRunTime: true,
     medRunTime: false,
index 3d32dad68eee8b700a6aed3b2a4811876d978427..f6e132c88514e3012dcf732cb01cde69a4b26410 100644 (file)
@@ -8,7 +8,7 @@ import { LeastUsedWorkerChoiceStrategy } from './least-used-worker-choice-strate
 import { RoundRobinWorkerChoiceStrategy } from './round-robin-worker-choice-strategy'
 import type {
   IWorkerChoiceStrategy,
-  TaskStatistics,
+  TaskStatisticsRequirements,
   WorkerChoiceStrategy,
   WorkerChoiceStrategyOptions
 } from './selection-strategies-types'
@@ -97,16 +97,16 @@ export class WorkerChoiceStrategyContext<
   }
 
   /**
-   * Gets the worker choice strategy task statistics in the context.
+   * Gets the worker choice strategy task statistics requirements in the context.
    *
-   * @returns The task statistics.
+   * @returns The task statistics requirements.
    */
-  public getTaskStatistics (): TaskStatistics {
+  public getTaskStatisticsRequirements (): TaskStatisticsRequirements {
     return (
       this.workerChoiceStrategies.get(
         this.workerChoiceStrategy
       ) as IWorkerChoiceStrategy
-    ).taskStatistics
+    ).taskStatisticsRequirements
   }
 
   /**
index ead69d06367e9d19921c4952345971ec6f51f795..45371a31325e6cea532e87edd9b0c9c0fccd78dd 100644 (file)
@@ -193,7 +193,9 @@ describe('Abstract pool test suite', () => {
         medWaitTime: false
       })
     }
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: true,
       avgRunTime: true,
       medRunTime: false,
@@ -210,7 +212,9 @@ describe('Abstract pool test suite', () => {
       .workerChoiceStrategies) {
       expect(workerChoiceStrategy.opts).toStrictEqual({ medRunTime: true })
     }
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: true,
       avgRunTime: false,
       medRunTime: true,
@@ -227,7 +231,9 @@ describe('Abstract pool test suite', () => {
       .workerChoiceStrategies) {
       expect(workerChoiceStrategy.opts).toStrictEqual({ medRunTime: false })
     }
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: true,
       avgRunTime: true,
       medRunTime: false,
index 62e2e5220abbb936df71809787486ad27fbb4720..7a67f6c4b628922db22a760de4d3f5bafc117fea 100644 (file)
@@ -121,7 +121,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: false,
       avgRunTime: false,
       medRunTime: false,
@@ -137,7 +139,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: false,
       avgRunTime: false,
       medRunTime: false,
@@ -314,7 +318,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: false,
       avgRunTime: false,
       medRunTime: false,
@@ -330,7 +336,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: false,
       avgRunTime: false,
       medRunTime: false,
@@ -432,7 +440,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: true,
       avgRunTime: false,
       medRunTime: false,
@@ -448,7 +458,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: true,
       avgRunTime: false,
       medRunTime: false,
@@ -561,7 +573,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: true,
       avgRunTime: true,
       medRunTime: false,
@@ -577,7 +591,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: true,
       avgRunTime: true,
       medRunTime: false,
@@ -819,7 +835,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: true,
       avgRunTime: true,
       medRunTime: false,
@@ -835,7 +853,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: true,
       avgRunTime: true,
       medRunTime: false,
@@ -1111,7 +1131,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: false,
       avgRunTime: false,
       medRunTime: false,
@@ -1127,7 +1149,9 @@ describe('Selection strategies test suite', () => {
       './tests/worker-files/thread/testWorker.js',
       { workerChoiceStrategy }
     )
-    expect(pool.workerChoiceStrategyContext.getTaskStatistics()).toStrictEqual({
+    expect(
+      pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
+    ).toStrictEqual({
       runTime: false,
       avgRunTime: false,
       medRunTime: false,
index 5e202039f67ba4872c594294d480ed8cecb90da6..2c5b7abbcc78c1429e9f23d0a8a414a659232c52 100644 (file)
@@ -368,12 +368,12 @@ describe('Worker choice strategy context test suite', () => {
         medRunTime: true
       }
     )
-    expect(workerChoiceStrategyContext.getTaskStatistics().avgRunTime).toBe(
-      false
-    )
-    expect(workerChoiceStrategyContext.getTaskStatistics().medRunTime).toBe(
-      true
-    )
+    expect(
+      workerChoiceStrategyContext.getTaskStatisticsRequirements().avgRunTime
+    ).toBe(false)
+    expect(
+      workerChoiceStrategyContext.getTaskStatisticsRequirements().medRunTime
+    ).toBe(true)
     workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
       dynamicPool,
       wwrWorkerChoiceStrategy,
@@ -381,12 +381,12 @@ describe('Worker choice strategy context test suite', () => {
         medRunTime: true
       }
     )
-    expect(workerChoiceStrategyContext.getTaskStatistics().avgRunTime).toBe(
-      false
-    )
-    expect(workerChoiceStrategyContext.getTaskStatistics().medRunTime).toBe(
-      true
-    )
+    expect(
+      workerChoiceStrategyContext.getTaskStatisticsRequirements().avgRunTime
+    ).toBe(false)
+    expect(
+      workerChoiceStrategyContext.getTaskStatisticsRequirements().medRunTime
+    ).toBe(true)
     const fsWorkerChoiceStrategy = WorkerChoiceStrategies.FAIR_SHARE
     workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
       fixedPool,
@@ -395,12 +395,12 @@ describe('Worker choice strategy context test suite', () => {
         medRunTime: true
       }
     )
-    expect(workerChoiceStrategyContext.getTaskStatistics().avgRunTime).toBe(
-      false
-    )
-    expect(workerChoiceStrategyContext.getTaskStatistics().medRunTime).toBe(
-      true
-    )
+    expect(
+      workerChoiceStrategyContext.getTaskStatisticsRequirements().avgRunTime
+    ).toBe(false)
+    expect(
+      workerChoiceStrategyContext.getTaskStatisticsRequirements().medRunTime
+    ).toBe(true)
     workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
       dynamicPool,
       fsWorkerChoiceStrategy,
@@ -408,11 +408,11 @@ describe('Worker choice strategy context test suite', () => {
         medRunTime: true
       }
     )
-    expect(workerChoiceStrategyContext.getTaskStatistics().avgRunTime).toBe(
-      false
-    )
-    expect(workerChoiceStrategyContext.getTaskStatistics().medRunTime).toBe(
-      true
-    )
+    expect(
+      workerChoiceStrategyContext.getTaskStatisticsRequirements().avgRunTime
+    ).toBe(false)
+    expect(
+      workerChoiceStrategyContext.getTaskStatisticsRequirements().medRunTime
+    ).toBe(true)
   })
 })