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>
This commit is contained in:
parent
25385ef26a
commit
8997026d18
@ -3,16 +3,16 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
if (common.isWindows) {
|
if (common.isWindows) {
|
||||||
common.skip('no signals on Windows');
|
common.skip('no signals on Windows');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const initHooks = require('./init-hooks');
|
const initHooks = require('./init-hooks');
|
||||||
const verifyGraph = require('./verify-graph');
|
const verifyGraph = require('./verify-graph');
|
||||||
const exec = require('child_process').exec;
|
const { exec } = require('child_process');
|
||||||
|
|
||||||
const hooks = initHooks();
|
const hooks = initHooks();
|
||||||
|
|
||||||
hooks.enable();
|
hooks.enable();
|
||||||
|
const interval = setInterval(() => {}, 9999); // keep event loop open
|
||||||
process.on('SIGUSR2', common.mustCall(onsigusr2, 2));
|
process.on('SIGUSR2', common.mustCall(onsigusr2, 2));
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
@ -33,7 +33,9 @@ function onsigusr2() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onsigusr2Again() {}
|
function onsigusr2Again() {
|
||||||
|
clearInterval(interval); // let the event loop close
|
||||||
|
}
|
||||||
|
|
||||||
process.on('exit', onexit);
|
process.on('exit', onexit);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user