From 1196343d03cad59d9ddef8fe5179793492876d69 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. PR-URL: https://github.com/nodejs/node/pull/44433 Refs: https://github.com/nodejs/reliability/issues/333 Refs: https://github.com/nodejs/reliability/issues/361 Reviewed-By: Luigi Pinca Reviewed-By: Chengzhong Wu Reviewed-By: Stephen Belanger --- 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 a3cb3dbc7fd..db40d0ef1cc 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 3451c0af71c..0687b3b3c81 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 0e82ab8c86a..36a76001af3 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!`); }