Skip to content
Permalink
Browse files

test: fix flaky test-http-server-keepalive-req-gc

Use `server` to keep the event loop open until the `ongc` listener runs.

PR-URL: #29347
Fixes: #29344
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
  • Loading branch information...
Trott authored and BridgeAR committed Aug 27, 2019
1 parent f4f8827 commit bd1e8eacf32ced3df7e7104f85d13f10d6b0d017
Showing with 1 addition and 3 deletions.
  1. +1 −3 test/parallel/test-http-server-keepalive-req-gc.js
@@ -16,7 +16,7 @@ if (common.isWindows) {

let client;
const server = createServer(common.mustCall((req, res) => {
onGC(req, { ongc: common.mustCall() });
onGC(req, { ongc: common.mustCall(() => { server.close(); }) });
req.resume();
req.on('end', common.mustCall(() => {
setImmediate(() => {
@@ -27,8 +27,6 @@ const server = createServer(common.mustCall((req, res) => {
res.end('hello world');
}));

server.unref();

server.listen(0, common.mustCall(() => {
client = connect(server.address().port);

0 comments on commit bd1e8ea

Please sign in to comment.
You can’t perform that action at this time.