repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of github.com:poolifier/poolifier
[poolifier.git]
/
tests
/
pools
/
selection-strategies
/
selection-strategies.test.mjs
diff --git
a/tests/pools/selection-strategies/selection-strategies.test.mjs
b/tests/pools/selection-strategies/selection-strategies.test.mjs
index 0feb5387ca7dcf162541023b3f0db56c472e4239..e17191557a96edb785748c1fb744bf55f81a15a3 100644
(file)
--- a/
tests/pools/selection-strategies/selection-strategies.test.mjs
+++ b/
tests/pools/selection-strategies/selection-strategies.test.mjs
@@
-157,6
+157,13
@@
describe('Selection strategies test suite', () => {
workerChoiceStrategy
).roundWeights.length
).toBe(1)
workerChoiceStrategy
).roundWeights.length
).toBe(1)
+ expect(
+ Number.isSafeInteger(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ workerChoiceStrategy
+ ).roundWeights[0]
+ )
+ ).toBe(true)
}
}
await pool.destroy()
}
}
await pool.destroy()
@@
-1636,7
+1643,7
@@
describe('Selection strategies test suite', () => {
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
- ).toEqual(
expect.any(Number)
)
+ ).toEqual(
0
)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
@@
-1705,12
+1712,12
@@
describe('Selection strategies test suite', () => {
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
- ).toEqual(
expect.any(Number)
)
+ ).toEqual(
0
)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
- ).toEqual(
expect.any(Number)
)
+ ).toEqual(
0
)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
@@
-1784,12
+1791,12
@@
describe('Selection strategies test suite', () => {
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).nextWorkerNodeKey
- ).toEqual(
expect.any(Number)
)
+ ).toEqual(
0
)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
- ).toEqual(
expect.any(Number)
)
+ ).toEqual(
0
)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
@@
-1961,7
+1968,7
@@
describe('Selection strategies test suite', () => {
await pool.destroy()
})
await pool.destroy()
})
- it
.skip
('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a fixed pool', async () => {
+ it('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a fixed pool', async () => {
const pool = new FixedThreadPool(
max,
'./tests/worker-files/thread/testWorker.mjs',
const pool = new FixedThreadPool(
max,
'./tests/worker-files/thread/testWorker.mjs',
@@
-2027,17
+2034,24
@@
describe('Selection strategies test suite', () => {
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
- ).toEqual(
expect.any(Number)
)
+ ).toEqual(
0
)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights.length
).toBe(1)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights.length
).toBe(1)
+ expect(
+ Number.isSafeInteger(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).roundWeights[0]
+ )
+ ).toBe(true)
// We need to clean up the resources after our test
await pool.destroy()
})
// We need to clean up the resources after our test
await pool.destroy()
})
- it
.skip
('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool', async () => {
+ it('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a dynamic pool', async () => {
const pool = new DynamicThreadPool(
min,
max,
const pool = new DynamicThreadPool(
min,
max,
@@
-2104,12
+2118,19
@@
describe('Selection strategies test suite', () => {
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).previousWorkerNodeKey
- ).toEqual(
expect.any(Number)
)
+ ).toEqual(
0
)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights.length
).toBe(1)
expect(
pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights.length
).toBe(1)
+ expect(
+ Number.isSafeInteger(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).roundWeights[0]
+ )
+ ).toBe(true)
// We need to clean up the resources after our test
await pool.destroy()
})
// We need to clean up the resources after our test
await pool.destroy()
})
@@
-2172,6
+2193,13
@@
describe('Selection strategies test suite', () => {
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights.length
).toBe(1)
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights.length
).toBe(1)
+ expect(
+ Number.isSafeInteger(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).roundWeights[0]
+ )
+ ).toBe(true)
await pool.destroy()
pool = new DynamicThreadPool(
min,
await pool.destroy()
pool = new DynamicThreadPool(
min,
@@
-2229,6
+2257,13
@@
describe('Selection strategies test suite', () => {
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights.length
).toBe(1)
pool.workerChoiceStrategyContext.workerChoiceStrategy
).roundWeights.length
).toBe(1)
+ expect(
+ Number.isSafeInteger(
+ pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ pool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).roundWeights[0]
+ )
+ ).toBe(true)
// We need to clean up the resources after our test
await pool.destroy()
})
// We need to clean up the resources after our test
await pool.destroy()
})