'./tests/worker-files/thread/testWorker.js'
)
for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) {
- if (workerChoiceStrategy === WorkerChoiceStrategies.ROUND_ROBIN) {
- expect(
- pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
- ).nextWorkerNodeKey
- ).toBe(0)
- } else if (workerChoiceStrategy === WorkerChoiceStrategies.FAIR_SHARE) {
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).nextWorkerNodeKey
+ ).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
+ if (workerChoiceStrategy === WorkerChoiceStrategies.FAIR_SHARE) {
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
- ).nextWorkerNodeKey
+ ).defaultWorkerWeight
+ ).toBeGreaterThan(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).workerVirtualTaskRunTime
).toBe(0)
+ } else if (
+ workerChoiceStrategy ===
+ WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
+ ) {
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
workerChoiceStrategy
).workerVirtualTaskRunTime
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).roundId
+ ).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).workerNodeId
+ ).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).roundWeights
+ ).toStrictEqual([
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).defaultWorkerWeight
+ ])
}
}
await pool.destroy()
})
it('Verify ROUND_ROBIN strategy can be run in a fixed pool', async () => {
+ const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN
const pool = new FixedThreadPool(
max,
'./tests/worker-files/thread/testWorker.js',
- { workerChoiceStrategy: WorkerChoiceStrategies.ROUND_ROBIN }
+ { workerChoiceStrategy }
)
// TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose`
const promises = new Set()
failed: 0
},
runTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
}
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- WorkerChoiceStrategies.ROUND_ROBIN
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(pool.workerNodes.length - 1)
// We need to clean up the resources after our test
await pool.destroy()
})
it('Verify ROUND_ROBIN strategy can be run in a dynamic pool', async () => {
+ const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN
const pool = new DynamicThreadPool(
min,
max,
'./tests/worker-files/thread/testWorker.js',
- { workerChoiceStrategy: WorkerChoiceStrategies.ROUND_ROBIN }
+ { workerChoiceStrategy }
)
// TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose`
const promises = new Set()
failed: 0
},
runTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
}
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- WorkerChoiceStrategies.ROUND_ROBIN
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(pool.workerNodes.length - 1)
// We need to clean up the resources after our test
await pool.destroy()
})
)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBeDefined()
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBeDefined()
pool.setWorkerChoiceStrategy(workerChoiceStrategy)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
await pool.destroy()
pool = new DynamicThreadPool(
min,
)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBeDefined()
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBeDefined()
pool.setWorkerChoiceStrategy(workerChoiceStrategy)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
// We need to clean up the resources after our test
await pool.destroy()
})
failed: 0
},
runTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
failed: 0
},
runTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
- expect(workerNode.usage).toMatchObject({
+ expect(workerNode.usage).toStrictEqual({
tasks: {
executed: expect.any(Number),
executing: 0,
stolen: 0,
failed: 0
},
- runTime: {
+ runTime: expect.objectContaining({
history: expect.any(CircularArray)
- },
- waitTime: {
+ }),
+ waitTime: expect.objectContaining({
history: expect.any(CircularArray)
- },
+ }),
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
- expect(workerNode.usage).toMatchObject({
+ expect(workerNode.usage).toStrictEqual({
tasks: {
executed: expect.any(Number),
executing: 0,
stolen: 0,
failed: 0
},
- runTime: {
+ runTime: expect.objectContaining({
history: expect.any(CircularArray)
- },
- waitTime: {
+ }),
+ waitTime: expect.objectContaining({
history: expect.any(CircularArray)
- },
+ }),
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
- expect(workerNode.usage).toMatchObject({
+ expect(workerNode.usage).toStrictEqual({
tasks: {
executed: expect.any(Number),
executing: 0,
failed: 0
},
runTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
- elu: {
- idle: {
+ elu: expect.objectContaining({
+ idle: expect.objectContaining({
history: expect.any(CircularArray)
- },
- active: {
+ }),
+ active: expect.objectContaining({
history: expect.any(CircularArray)
- }
- }
+ })
+ })
})
expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
expect(workerNode.usage.tasks.executed).toBeLessThanOrEqual(
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
- expect(workerNode.usage).toMatchObject({
+ expect(workerNode.usage).toStrictEqual({
tasks: {
executed: expect.any(Number),
executing: 0,
failed: 0
},
runTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
- elu: {
- idle: {
+ elu: expect.objectContaining({
+ idle: expect.objectContaining({
history: expect.any(CircularArray)
- },
- active: {
+ }),
+ active: expect.objectContaining({
history: expect.any(CircularArray)
- }
- }
+ })
+ })
})
expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
expect(workerNode.usage.tasks.executed).toBeLessThanOrEqual(
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
- expect(workerNode.usage).toMatchObject({
+ expect(workerNode.usage).toStrictEqual({
tasks: {
executed: expect.any(Number),
executing: 0,
stolen: 0,
failed: 0
},
- runTime: {
+ runTime: expect.objectContaining({
history: expect.any(CircularArray)
- },
+ }),
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
- elu: {
- idle: {
+ elu: expect.objectContaining({
+ idle: expect.objectContaining({
history: expect.any(CircularArray)
- },
- active: {
+ }),
+ active: expect.objectContaining({
history: expect.any(CircularArray)
- }
- }
+ })
+ })
})
expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
expect(workerNode.usage.tasks.executed).toBeLessThanOrEqual(
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
- expect(workerNode.usage).toMatchObject({
+ expect(workerNode.usage).toStrictEqual({
tasks: {
executed: expect.any(Number),
executing: 0,
stolen: 0,
failed: 0
},
- runTime: {
+ runTime: expect.objectContaining({
history: expect.any(CircularArray)
- },
+ }),
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
- elu: {
- idle: {
+ elu: expect.objectContaining({
+ idle: expect.objectContaining({
history: expect.any(CircularArray)
- },
- active: {
+ }),
+ active: expect.objectContaining({
history: expect.any(CircularArray)
- }
- }
+ })
+ })
})
expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
expect(workerNode.usage.tasks.executed).toBeLessThanOrEqual(
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
- expect(workerNode.usage).toMatchObject({
+ expect(workerNode.usage).toStrictEqual({
tasks: {
executed: expect.any(Number),
executing: 0,
stolen: 0,
failed: 0
},
- runTime: {
+ runTime: expect.objectContaining({
history: expect.any(CircularArray)
- },
+ }),
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
- elu: {
- idle: {
+ elu: expect.objectContaining({
+ idle: expect.objectContaining({
history: expect.any(CircularArray)
- },
- active: {
+ }),
+ active: expect.objectContaining({
history: expect.any(CircularArray)
- }
- }
+ })
+ })
})
expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
expect(workerNode.usage.tasks.executed).toBeLessThanOrEqual(
pool.setWorkerChoiceStrategy(workerChoiceStrategy)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).workersVirtualTaskEndTimestamp
).toBeInstanceOf(Array)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).workersVirtualTaskEndTimestamp.length
).toBe(0)
await pool.destroy()
pool.setWorkerChoiceStrategy(workerChoiceStrategy)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).workersVirtualTaskEndTimestamp
).toBeInstanceOf(Array)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).workersVirtualTaskEndTimestamp.length
).toBe(0)
// We need to clean up the resources after our test
history: expect.any(CircularArray)
}),
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
expect(workerNode.usage.runTime.average).toBeGreaterThan(0)
}
}
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).nextWorkerNodeKey
+ ).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
history: expect.any(CircularArray)
}),
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
expect(workerNode.usage.runTime.average).toBeGreaterThan(0)
}
}
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).nextWorkerNodeKey
+ ).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
history: expect.any(CircularArray)
}),
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
expect(workerNode.usage.runTime.median).toBeGreaterThan(0)
}
}
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).nextWorkerNodeKey
+ ).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
workerChoiceStrategy
).nextWorkerNodeKey
).toBeDefined()
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBeDefined()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).toBeGreaterThan(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).workerVirtualTaskRunTime
).toBe(0)
await pool.destroy()
workerChoiceStrategy
).nextWorkerNodeKey
).toBeDefined()
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBeDefined()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).toBeGreaterThan(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).workerVirtualTaskRunTime
).toBe(0)
// We need to clean up the resources after our test
pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
).toStrictEqual({
runTime: {
- aggregate: false,
- average: false,
+ aggregate: true,
+ average: true,
median: false
},
waitTime: {
pool.workerChoiceStrategyContext.getTaskStatisticsRequirements()
).toStrictEqual({
runTime: {
- aggregate: false,
- average: false,
+ aggregate: true,
+ average: true,
median: false
},
waitTime: {
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: {
+ runTime: expect.objectContaining({
history: expect.any(CircularArray)
- },
+ }),
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
+ expect(workerNode.usage.tasks.executed).toBeGreaterThanOrEqual(0)
+ expect(workerNode.usage.tasks.executed).toBeLessThanOrEqual(
+ max * maxMultiplier
+ )
}
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundId
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).workerNodeId
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toEqual(expect.any(Number))
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
stolen: 0,
failed: 0
},
- runTime: {
+ runTime: expect.objectContaining({
history: expect.any(CircularArray)
- },
+ }),
waitTime: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
elu: {
idle: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
},
active: {
- history: expect.any(CircularArray)
+ history: new CircularArray()
}
}
})
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundId
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).workerNodeId
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toEqual(expect.any(Number))
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
workerChoiceStrategy
).roundId
).toBeDefined()
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).workerNodeId
+ ).toBeDefined()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
).nextWorkerNodeKey
).toBeDefined()
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBeDefined()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
pool.setWorkerChoiceStrategy(workerChoiceStrategy)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundId
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).workerNodeId
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).toBeGreaterThan(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights
).toStrictEqual([
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
).roundId
).toBeDefined()
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).workerNodeId
+ ).toBeDefined()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
).nextWorkerNodeKey
).toBeDefined()
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBeDefined()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
workerChoiceStrategy
).roundWeights
).toBeDefined()
pool.setWorkerChoiceStrategy(workerChoiceStrategy)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).roundId
+ ).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).workerNodeId
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
).toBe(0)
+ expect(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).previousWorkerNodeKey
+ ).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).toBeGreaterThan(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- workerChoiceStrategy
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights
).toStrictEqual([
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(