repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump typedoc from 0.20.31 to 0.20.32 (#273)
[poolifier.git]
/
tests
/
pools
/
thread
/
dynamic.test.js
diff --git
a/tests/pools/thread/dynamic.test.js
b/tests/pools/thread/dynamic.test.js
index 2e3a849257befecc2e3564518c099d2fa267005d..9cba566f916abccdd380b38a0795a5502992a933 100644
(file)
--- a/
tests/pools/thread/dynamic.test.js
+++ b/
tests/pools/thread/dynamic.test.js
@@
-21,13
+21,13
@@
describe('Dynamic thread pool test suite', () => {
it('Verify that new workers are created when required, max size is not exceeded and that after a while new workers will die', async () => {
const promises = []
it('Verify that new workers are created when required, max size is not exceeded and that after a while new workers will die', async () => {
const promises = []
- let
b
usy = 0
- pool.emitter.on('busy', () =>
b
usy++)
+ let
poolB
usy = 0
+ pool.emitter.on('busy', () =>
poolB
usy++)
for (let i = 0; i < max * 2; i++) {
promises.push(pool.execute({ test: 'test' }))
}
expect(pool.workers.length).toBe(max)
for (let i = 0; i < max * 2; i++) {
promises.push(pool.execute({ test: 'test' }))
}
expect(pool.workers.length).toBe(max)
- expect(
busy > 1).toBeTruthy(
)
+ expect(
poolBusy).toBe(max + 1
)
const res = await TestUtils.waitExits(pool, max - min)
expect(res).toBe(max - min)
})
const res = await TestUtils.waitExits(pool, max - min)
expect(res).toBe(max - min)
})
@@
-72,6
+72,7
@@
describe('Dynamic thread pool test suite', () => {
'./tests/worker-files/thread/testWorker.js'
)
const res = await pool1.execute({ test: 'test' })
'./tests/worker-files/thread/testWorker.js'
)
const res = await pool1.execute({ test: 'test' })
+ expect(res).toBeDefined()
expect(res).toBeFalsy()
// We need to clean up the resources after our test
await pool1.destroy()
expect(res).toBeFalsy()
// We need to clean up the resources after our test
await pool1.destroy()
@@
-84,7
+85,8
@@
describe('Dynamic thread pool test suite', () => {
'./tests/worker-files/thread/longRunningWorkerHardBehavior.js',
{
errorHandler: e => console.error(e),
'./tests/worker-files/thread/longRunningWorkerHardBehavior.js',
{
errorHandler: e => console.error(e),
- onlineHandler: () => console.log('worker is online')
+ onlineHandler: () => console.log('long running worker is online'),
+ exitHandler: () => console.log('long running worker exited')
}
)
expect(longRunningPool.workers.length).toBe(min)
}
)
expect(longRunningPool.workers.length).toBe(min)
@@
-105,7
+107,8
@@
describe('Dynamic thread pool test suite', () => {
'./tests/worker-files/thread/longRunningWorkerSoftBehavior.js',
{
errorHandler: e => console.error(e),
'./tests/worker-files/thread/longRunningWorkerSoftBehavior.js',
{
errorHandler: e => console.error(e),
- onlineHandler: () => console.log('worker is online')
+ onlineHandler: () => console.log('long running worker is online'),
+ exitHandler: () => console.log('long running worker exited')
}
)
expect(longRunningPool.workers.length).toBe(min)
}
)
expect(longRunningPool.workers.length).toBe(min)