- pool.destroy()
- })
-
- it('Simulate worker not found during increaseWorkerRunningTasks', () => {
- const pool = new StubPoolWithWorkerTasksUsageMapClear(
- numberOfWorkers,
- './tests/worker-files/cluster/testWorker.js'
- )
- // Simulate worker not found.
- pool.removeAllWorker()
- expect(() => pool.increaseWorkerRunningTasks()).toThrowError(
- workerNotFoundInTasksUsageMapError
- )
- pool.destroy()
- })
-
- it('Simulate worker not found during decreaseWorkerRunningTasks', () => {
- const pool = new StubPoolWithWorkerTasksUsageMapClear(
- numberOfWorkers,
- './tests/worker-files/cluster/testWorker.js',
- {
- errorHandler: e => console.error(e)
- }
- )
- // Simulate worker not found.
- pool.removeAllWorker()
- expect(() => pool.decreaseWorkerRunningTasks()).toThrowError(
- workerNotFoundInTasksUsageMapError
- )
- pool.destroy()
- })
-
- it('Simulate worker not found during stepWorkerRunTasks', () => {
- const pool = new StubPoolWithWorkerTasksUsageMapClear(
- numberOfWorkers,
- './tests/worker-files/cluster/testWorker.js',
- {
- errorHandler: e => console.error(e)
- }
- )
- // Simulate worker not found.
- pool.removeAllWorker()
- expect(() => pool.stepWorkerRunTasks()).toThrowError(
- workerNotFoundInTasksUsageMapError
- )
- pool.destroy()
- })
-
- it('Simulate worker not found during updateWorkerTasksRunTime with strategy not requiring it', () => {
- const pool = new StubPoolWithWorkerTasksUsageMapClear(
- numberOfWorkers,
- './tests/worker-files/cluster/testWorker.js',
- {
- errorHandler: e => console.error(e)
- }
- )
- // Simulate worker not found.
- pool.removeAllWorker()
- expect(() => pool.updateWorkerTasksRunTime()).not.toThrowError()
- pool.destroy()