expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.ROUND_ROBIN
- ).nextWorkerId
+ ).nextWorkerNodeId
).toBe(0)
// We need to clean up the resources after our test
await pool.destroy()
)
let results = new Set()
for (let i = 0; i < max; i++) {
- results.add(pool.chooseWorker()[1].id)
+ results.add(pool.chooseWorkerNode()[1].worker.id)
}
expect(results.size).toBe(max)
await pool.destroy()
pool = new FixedThreadPool(max, './tests/worker-files/thread/testWorker.js')
results = new Set()
for (let i = 0; i < max; i++) {
- results.add(pool.chooseWorker()[1].threadId)
+ results.add(pool.chooseWorkerNode()[1].worker.threadId)
}
expect(results.size).toBe(max)
await pool.destroy()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.ROUND_ROBIN
- ).nextWorkerId
+ ).nextWorkerNodeId
).toBeDefined()
pool.setWorkerChoiceStrategy(WorkerChoiceStrategies.ROUND_ROBIN)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.ROUND_ROBIN
- ).nextWorkerId
+ ).nextWorkerNodeId
).toBe(0)
await pool.destroy()
pool = new DynamicThreadPool(
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.ROUND_ROBIN
- ).nextWorkerId
+ ).nextWorkerNodeId
).toBeDefined()
pool.setWorkerChoiceStrategy(WorkerChoiceStrategies.ROUND_ROBIN)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.ROUND_ROBIN
- ).nextWorkerId
+ ).nextWorkerNodeId
).toBe(0)
// We need to clean up the resources after our test
await pool.destroy()
expect(pool.opts.workerChoiceStrategy).toBe(
WorkerChoiceStrategies.FAIR_SHARE
)
- for (const workerKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
+ for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.FAIR_SHARE)
.workerLastVirtualTaskTimestamp.keys()) {
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.FAIR_SHARE)
- .workerLastVirtualTaskTimestamp.get(workerKey).start
+ .workerLastVirtualTaskTimestamp.get(workerNodeKey).start
).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.FAIR_SHARE)
- .workerLastVirtualTaskTimestamp.get(workerKey).end
+ .workerLastVirtualTaskTimestamp.get(workerNodeKey).end
).toBe(0)
}
// We need to clean up the resources after our test
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.FAIR_SHARE
).workerLastVirtualTaskTimestamp.size
- ).toBe(pool.workers.length)
+ ).toBe(pool.workerNodes.length)
// We need to clean up the resources after our test
await pool.destroy()
})
// pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
// WorkerChoiceStrategies.FAIR_SHARE
// ).workerLastVirtualTaskTimestamp.size
- // ).toBe(pool.workers.length)
+ // ).toBe(pool.workerNodes.length)
// }
// We need to clean up the resources after our test
await pool.destroy()
).workerLastVirtualTaskTimestamp
).toBeDefined()
pool.setWorkerChoiceStrategy(WorkerChoiceStrategies.FAIR_SHARE)
- for (const workerKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
+ for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.FAIR_SHARE)
.workerLastVirtualTaskTimestamp.keys()) {
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.FAIR_SHARE)
- .workerLastVirtualTaskTimestamp.get(workerKey).start
+ .workerLastVirtualTaskTimestamp.get(workerNodeKey).start
).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.FAIR_SHARE)
- .workerLastVirtualTaskTimestamp.get(workerKey).end
+ .workerLastVirtualTaskTimestamp.get(workerNodeKey).end
).toBe(0)
}
await pool.destroy()
).workerLastVirtualTaskTimestamp
).toBeDefined()
pool.setWorkerChoiceStrategy(WorkerChoiceStrategies.FAIR_SHARE)
- for (const workerKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
+ for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.FAIR_SHARE)
.workerLastVirtualTaskTimestamp.keys()) {
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.FAIR_SHARE)
- .workerLastVirtualTaskTimestamp.get(workerKey).start
+ .workerLastVirtualTaskTimestamp.get(workerNodeKey).start
).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.FAIR_SHARE)
- .workerLastVirtualTaskTimestamp.get(workerKey).end
+ .workerLastVirtualTaskTimestamp.get(workerNodeKey).end
).toBe(0)
}
// We need to clean up the resources after our test
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
- ).currentWorkerId
+ ).currentWorkerNodeId
).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
).defaultWorkerWeight
).toBeGreaterThan(0)
- for (const workerKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
+ for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN)
.workersTaskRunTime.keys()) {
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN)
- .workersTaskRunTime.get(workerKey).weight
+ .workersTaskRunTime.get(workerNodeKey).weight
).toBeGreaterThan(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN)
- .workersTaskRunTime.get(workerKey).runTime
+ .workersTaskRunTime.get(workerNodeKey).runTime
).toBe(0)
}
// We need to clean up the resources after our test
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
).workersTaskRunTime.size
- ).toBe(pool.workers.length)
+ ).toBe(pool.workerNodes.length)
// We need to clean up the resources after our test
await pool.destroy()
})
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
).workersTaskRunTime.size
- ).toBe(pool.workers.length)
+ ).toBe(pool.workerNodes.length)
}
// We need to clean up the resources after our test
await pool.destroy()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
- ).currentWorkerId
+ ).currentWorkerNodeId
).toBeDefined()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
- ).currentWorkerId
+ ).currentWorkerNodeId
).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
).defaultWorkerWeight
).toBeGreaterThan(0)
- for (const workerKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
+ for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN)
.workersTaskRunTime.keys()) {
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN)
- .workersTaskRunTime.get(workerKey).runTime
+ .workersTaskRunTime.get(workerNodeKey).runTime
).toBe(0)
}
await pool.destroy()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
- ).currentWorkerId
+ ).currentWorkerNodeId
).toBeDefined()
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
- ).currentWorkerId
+ ).currentWorkerNodeId
).toBe(0)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
).defaultWorkerWeight
).toBeGreaterThan(0)
- for (const workerKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
+ for (const workerNodeKey of pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN)
.workersTaskRunTime.keys()) {
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies
.get(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN)
- .workersTaskRunTime.get(workerKey).runTime
+ .workersTaskRunTime.get(workerNodeKey).runTime
).toBe(0)
}
// We need to clean up the resources after our test