repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
perf: use worker key as much as possible instead of a reference to the
[poolifier.git]
/
tests
/
pools
/
selection-strategies
/
worker-choice-strategy-context.test.js
diff --git
a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js
b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js
index 9380a038800abcb246c532240717940fe735e79f..9ab2babfd31ce26fa6286338ced68d2e4f2ae7ea 100644
(file)
--- a/
tests/pools/selection-strategies/worker-choice-strategy-context.test.js
+++ b/
tests/pools/selection-strategies/worker-choice-strategy-context.test.js
@@
-60,15
+60,15
@@
describe('Worker choice strategy context test suite', () => {
const WorkerChoiceStrategyStub = sinon.createStubInstance(
RoundRobinWorkerChoiceStrategy,
{
const WorkerChoiceStrategyStub = sinon.createStubInstance(
RoundRobinWorkerChoiceStrategy,
{
- choose: sinon.stub().returns(
'worker'
)
+ choose: sinon.stub().returns(
0
)
}
)
workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub
}
)
workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub
- const chosenWorker = workerChoiceStrategyContext.execute()
+ const chosenWorker
Key
= workerChoiceStrategyContext.execute()
expect(
workerChoiceStrategyContext.getWorkerChoiceStrategy().choose.calledOnce
).toBe(true)
expect(
workerChoiceStrategyContext.getWorkerChoiceStrategy().choose.calledOnce
).toBe(true)
- expect(chosenWorker
).toBe('worker'
)
+ expect(chosenWorker
Key).toBe(0
)
})
it('Verify that execute() return the worker chosen by the strategy with dynamic pool', () => {
})
it('Verify that execute() return the worker chosen by the strategy with dynamic pool', () => {
@@
-78,15
+78,15
@@
describe('Worker choice strategy context test suite', () => {
const WorkerChoiceStrategyStub = sinon.createStubInstance(
RoundRobinWorkerChoiceStrategy,
{
const WorkerChoiceStrategyStub = sinon.createStubInstance(
RoundRobinWorkerChoiceStrategy,
{
- choose: sinon.stub().returns(
'worker'
)
+ choose: sinon.stub().returns(
0
)
}
)
workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub
}
)
workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub
- const chosenWorker = workerChoiceStrategyContext.execute()
+ const chosenWorker
Key
= workerChoiceStrategyContext.execute()
expect(
workerChoiceStrategyContext.getWorkerChoiceStrategy().choose.calledOnce
).toBe(true)
expect(
workerChoiceStrategyContext.getWorkerChoiceStrategy().choose.calledOnce
).toBe(true)
- expect(chosenWorker
).toBe('worker'
)
+ expect(chosenWorker
Key).toBe(0
)
})
it('Verify that setWorkerChoiceStrategy() works with ROUND_ROBIN and fixed pool', () => {
})
it('Verify that setWorkerChoiceStrategy() works with ROUND_ROBIN and fixed pool', () => {