{ 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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
}
// We need to clean up the resources after our test
await pool.destroy()
{ 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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
}
// We need to clean up the resources after our test
await pool.destroy()
{ workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED }
)
// TODO: Create a better test to cover `LeastUsedWorkerChoiceStrategy#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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
}
// We need to clean up the resources after our test
await pool.destroy()
{ workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED }
)
// TODO: Create a better test to cover `LeastUsedWorkerChoiceStrategy#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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
}
// We need to clean up the resources after our test
await pool.destroy()
{ workerChoiceStrategy: WorkerChoiceStrategies.LEAST_BUSY }
)
// TODO: Create a better test to cover `LeastBusyWorkerChoiceStrategy#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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
}
// We need to clean up the resources after our test
{ workerChoiceStrategy: WorkerChoiceStrategies.LEAST_BUSY }
)
// TODO: Create a better test to cover `LeastBusyWorkerChoiceStrategy#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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
}
// We need to clean up the resources after our test
{ 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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
expect(workerNode.tasksUsage.avgRunTime).toBeGreaterThan(0)
}
{ 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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
expect(workerNode.tasksUsage.avgRunTime).toBeGreaterThan(0)
}
}
)
// 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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
expect(workerNode.tasksUsage.medRunTime).toBeGreaterThan(0)
}
{ 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) {
medWaitTime: 0,
error: 0
})
- expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
- expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
- expect(workerNode.tasksUsage.avgRunTime).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeGreaterThanOrEqual(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
+ expect(workerNode.tasksUsage.runTime).toBeGreaterThanOrEqual(0)
+ expect(workerNode.tasksUsage.avgRunTime).toBeGreaterThanOrEqual(0)
}
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
{ 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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
expect(workerNode.tasksUsage.avgRunTime).toBeGreaterThan(0)
}
}
)
// 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) {
error: 0
})
expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
expect(workerNode.tasksUsage.medRunTime).toBeGreaterThan(0)
}