- expect(longRunningPool.workers.length).toBe(max)
- await new Promise(resolve => setTimeout(resolve, 3000))
- // Here we expect the workers to be at the max size since that the task is still running
- expect(longRunningPool.workers.length).toBe(max)
+ expect(longRunningPool.workerNodes.length).toBe(max)
+ await TestUtils.sleep(1500)
+ // Here we expect the workerNodes to be at the max size since the task is still executing
+ expect(longRunningPool.workerNodes.length).toBe(max)
+ // We need to clean up the resources after our test
+ await longRunningPool.destroy()
+ })
+
+ it('Verify that a pool with zero worker can be instantiated', async () => {
+ const pool = new DynamicClusterPool(
+ 0,
+ max,
+ './tests/worker-files/cluster/testWorker.js'
+ )
+ expect(pool).toBeInstanceOf(DynamicClusterPool)
+ // We need to clean up the resources after our test
+ await pool.destroy()