test: fix pool destroy() test flakiness
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 21 Dec 2023 11:15:43 +0000 (12:15 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 21 Dec 2023 11:15:43 +0000 (12:15 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
tests/pools/abstract-pool.test.mjs

index 78fcd2dac9ab3d994d8f0a13b544799a35fb0fcf..0e363cb81823707a3ae5c50eb709639a65a28d60 100644 (file)
@@ -1298,7 +1298,8 @@ describe('Abstract pool test suite', () => {
     const startTime = performance.now()
     await pool.destroy()
     const elapsedTime = performance.now() - startTime
-    expect(tasksFinished).toBe(numberOfWorkers * maxMultiplier)
+    expect(tasksFinished).toBeGreaterThanOrEqual(numberOfWorkers)
+    expect(tasksFinished).toBeLessThanOrEqual(numberOfWorkers * maxMultiplier)
     expect(elapsedTime).toBeGreaterThanOrEqual(2000)
     expect(elapsedTime).toBeLessThanOrEqual(tasksFinishedTimeout + 100)
   })