diff options
author | Rich Trott <rtrott@gmail.com> | 2017-12-06 14:57:13 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-12-08 11:34:42 -0800 |
commit | 8997026d18cfd54a95c4de6dfdd86bef32f337ff (patch) | |
tree | f1f53fdf19094fee5178753c35c6bffcc81d9592 /test | |
parent | 25385ef26a768817da23746ad00ccf046f8790eb (diff) | |
download | node-new-8997026d18cfd54a95c4de6dfdd86bef32f337ff.tar.gz |
test: fix flaky async-hooks/test-graph.signal
Make sure event loop remains open long enough for signal to be received.
PR-URL: https://github.com/nodejs/node/pull/17509
Fixes: https://github.com/nodejs/node/issues/14568
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/async-hooks/test-graph.signal.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/async-hooks/test-graph.signal.js b/test/async-hooks/test-graph.signal.js index 92334b9826..770fe00da4 100644 --- a/test/async-hooks/test-graph.signal.js +++ b/test/async-hooks/test-graph.signal.js @@ -3,16 +3,16 @@ const common = require('../common'); if (common.isWindows) { common.skip('no signals on Windows'); - return; } const initHooks = require('./init-hooks'); const verifyGraph = require('./verify-graph'); -const exec = require('child_process').exec; +const { exec } = require('child_process'); const hooks = initHooks(); hooks.enable(); +const interval = setInterval(() => {}, 9999); // keep event loop open process.on('SIGUSR2', common.mustCall(onsigusr2, 2)); let count = 0; @@ -33,7 +33,9 @@ function onsigusr2() { } } -function onsigusr2Again() {} +function onsigusr2Again() { + clearInterval(interval); // let the event loop close +} process.on('exit', onexit); |