describe('Dynamic cluster pool test suite', () => {
const min = 1
const max = 3
- const pool = new DynamicClusterPool(
- min,
- max,
- './tests/worker-files/cluster/testWorker.cjs',
- {
- errorHandler: e => console.error(e),
- }
- )
+ let pool
+
+ before('Create pool', () => {
+ pool = new DynamicClusterPool(
+ min,
+ max,
+ './tests/worker-files/cluster/testWorker.cjs',
+ {
+ errorHandler: e => console.error(e),
+ }
+ )
+ })
it('Verify that the function is executed in a worker cluster', async () => {
let result = await pool.execute({
)
})
- it('Should work even without opts in input', async () => {
- const pool = new DynamicClusterPool(
- min,
- max,
- './tests/worker-files/cluster/testWorker.cjs'
- )
- const result = await pool.execute()
- expect(result).toStrictEqual({ ok: 1 })
- // We need to clean up the resources after our test
- await pool.destroy()
- })
-
it('Verify scale processes up and down is working when long executing task is used:hard', async () => {
const longRunningPool = new DynamicClusterPool(
min,
await pool.destroy()
})
- it('Should work even without opts in input', async () => {
- const workerFilePath = './tests/worker-files/cluster/testWorker.cjs'
- const pool = new FixedClusterPool(numberOfWorkers, workerFilePath)
- const res = await pool.execute()
- expect(res).toStrictEqual({ ok: 1 })
- // We need to clean up the resources after our test
- await pool.destroy()
- })
-
it('Verify destroyWorkerNode()', async () => {
const workerFilePath = './tests/worker-files/cluster/testWorker.cjs'
const pool = new FixedClusterPool(numberOfWorkers, workerFilePath)
describe('Dynamic thread pool test suite', () => {
const min = 1
const max = 3
- const pool = new DynamicThreadPool(
- min,
- max,
- './tests/worker-files/thread/testWorker.mjs',
- {
- errorHandler: e => console.error(e),
- }
- )
+ let pool
+
+ before('Create pool', () => {
+ pool = new DynamicThreadPool(
+ min,
+ max,
+ './tests/worker-files/thread/testWorker.mjs',
+ {
+ errorHandler: e => console.error(e),
+ }
+ )
+ })
it('Verify that the function is executed in a worker thread', async () => {
let result = await pool.execute({
)
})
- it('Should work even without opts in input', async () => {
- const pool = new DynamicThreadPool(
- min,
- max,
- './tests/worker-files/thread/testWorker.mjs'
- )
- const res = await pool.execute()
- expect(res).toStrictEqual({ ok: 1 })
- // We need to clean up the resources after our test
- await pool.destroy()
- })
-
it('Verify scale thread up and down is working when long executing task is used:hard', async () => {
const longRunningPool = new DynamicThreadPool(
min,
await pool.destroy()
})
- it('Should work even without opts in input', async () => {
- const workerFilePath = './tests/worker-files/thread/testWorker.mjs'
- const pool = new FixedThreadPool(numberOfThreads, workerFilePath)
- const res = await pool.execute()
- expect(res).toStrictEqual({ ok: 1 })
- // We need to clean up the resources after our test
- await pool.destroy()
- })
-
it('Verify destroyWorkerNode()', async () => {
const workerFilePath = './tests/worker-files/thread/testWorker.mjs'
const pool = new FixedThreadPool(numberOfThreads, workerFilePath)