this.choiceRetriesCount++
return this.execute()
} else if (workerNodeKey == null) {
- throw new TypeError('Worker node key chosen is null or undefined')
+ throw new TypeError(
+ `Worker node key chosen is null or undefined after ${this.choiceRetriesCount} retries`
+ )
}
return workerNodeKey
}
expect(chosenWorkerKey).toBe(0)
})
- it('Verify that execute() throws error if null or undefined is returned', () => {
+ it('Verify that execute() throws error if null or undefined is returned after retries', () => {
const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
fixedPool
)
WorkerChoiceStrategyUndefinedStub
)
expect(() => workerChoiceStrategyContext.execute()).toThrowError(
- new TypeError('Worker node key chosen is null or undefined')
+ new TypeError(
+ 'Worker node key chosen is null or undefined after 6 retries'
+ )
)
workerChoiceStrategyContext.workerChoiceStrategies.set(
workerChoiceStrategyContext.workerChoiceStrategy,
WorkerChoiceStrategyNullStub
)
expect(() => workerChoiceStrategyContext.execute()).toThrowError(
- new TypeError('Worker node key chosen is null or undefined')
+ new TypeError(
+ 'Worker node key chosen is null or undefined after 6 retries'
+ )
)
})