+
+ it('Verify scale processes up and down is working when long executing task is used:hard', async () => {
+ const longRunningPool = new DynamicClusterPool(
+ min,
+ max,
+ './tests/worker-files/cluster/longRunningWorkerHardBehavior.js',
+ {
+ errorHandler: e => console.error(e),
+ onlineHandler: () => console.log('long executing worker is online'),
+ exitHandler: () => console.log('long executing worker exited')
+ }
+ )
+ expect(longRunningPool.workerNodes.length).toBe(min)
+ for (let i = 0; i < max * 2; i++) {
+ longRunningPool.execute()
+ }
+ expect(longRunningPool.workerNodes.length).toBe(max)
+ await TestUtils.waitWorkerEvents(longRunningPool, 'exit', max - min)
+ expect(longRunningPool.workerNodes.length).toBe(min)
+ expect(
+ longRunningPool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+ longRunningPool.workerChoiceStrategyContext.workerChoiceStrategy
+ ).nextWorkerNodeId
+ ).toBeLessThan(longRunningPool.workerNodes.length)
+ // We need to clean up the resources after our test
+ await longRunningPool.destroy()
+ })
+
+ it('Verify scale processes up and down is working when long executing task is used:soft', async () => {