From a737491a63d38eba6894f692572cd8c334cf02b3 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sat, 9 Sep 2023 14:44:31 +0200 Subject: [PATCH] test: deflake test-http-regr-gh-2928 Hard code the value of the host parameter to `common.localhostIPv4` in `server.listen()` and `net.connect()`. This 1. ensures that the client `socket._handle` is not reinitialized during connection due to the family autodetection algorithm, preventing `parser.consume()` from being called with an invalid `socket._handle` parameter. 2. works around an issue in the FreeBSD 12 machine where the stress test is run where some sockets get stuck after connection. Closes: https://github.com/nodejs/node/pull/49565 Fixes: https://github.com/nodejs/node/issues/49564 --- test/sequential/test-http-regr-gh-2928.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/sequential/test-http-regr-gh-2928.js b/test/sequential/test-http-regr-gh-2928.js index 149aaeb6e6e420..0967f3dda2a48b 100644 --- a/test/sequential/test-http-regr-gh-2928.js +++ b/test/sequential/test-http-regr-gh-2928.js @@ -39,7 +39,9 @@ function execAndClose() { throw e; }); - parser.consume(socket._handle); + socket.on('connect', function() { + parser.consume(socket._handle); + }); parser.onIncoming = function onIncoming() { process.stdout.write('+');