From 1a79444b644ef894870b6ddba656d5a72b0853c5 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 29 Aug 2022 18:27:40 +0800 Subject: [PATCH] test: make the vm timeout escape tests more lenient Previously the tests required that Node.js finish the initialization of the watchdog thread and fires the timeout within 100ms, which can be difficult on certain systems under load. This patch relaxes the requirement to 2000ms. If there is a bug and the timeout can actually be escaped, raising the timeout to 2000ms would not make a difference anyway. --- test/parallel/test-vm-timeout-escape-promise-2.js | 2 +- test/parallel/test-vm-timeout-escape-promise-module.js | 2 +- test/parallel/test-vm-timeout-escape-promise.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-vm-timeout-escape-promise-2.js b/test/parallel/test-vm-timeout-escape-promise-2.js index a3cb3dbc7fd4..db40d0ef1ccc 100644 --- a/test/parallel/test-vm-timeout-escape-promise-2.js +++ b/test/parallel/test-vm-timeout-escape-promise-2.js @@ -16,7 +16,7 @@ function loop() { while (1) { const current = hrtime(); const span = (current - start) / NS_PER_MS; - if (span >= 100n) { + if (span >= 2000n) { throw new Error( `escaped timeout at ${span} milliseconds!`); } diff --git a/test/parallel/test-vm-timeout-escape-promise-module.js b/test/parallel/test-vm-timeout-escape-promise-module.js index 3451c0af71c1..0687b3b3c81f 100644 --- a/test/parallel/test-vm-timeout-escape-promise-module.js +++ b/test/parallel/test-vm-timeout-escape-promise-module.js @@ -18,7 +18,7 @@ function loop() { while (1) { const current = hrtime(); const span = (current - start) / NS_PER_MS; - if (span >= 100n) { + if (span >= 2000n) { throw new Error( `escaped timeout at ${span} milliseconds!`); } diff --git a/test/parallel/test-vm-timeout-escape-promise.js b/test/parallel/test-vm-timeout-escape-promise.js index 0e82ab8c86a9..36a76001af34 100644 --- a/test/parallel/test-vm-timeout-escape-promise.js +++ b/test/parallel/test-vm-timeout-escape-promise.js @@ -17,7 +17,7 @@ function loop() { while (1) { const current = hrtime(); const span = (current - start) / NS_PER_MS; - if (span >= 100n) { + if (span >= 2000n) { throw new Error( `escaped timeout at ${span} milliseconds!`); }