Skip to content

Commit b9e5b43

Browse files
lpincaruyadorno
authored andcommitted
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. PR-URL: #49574 Closes: #49565 Fixes: #49564 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7c5e322 commit b9e5b43

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/sequential/test-http-regr-gh-2928.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function execAndClose() {
2525
const parser = parsers.pop();
2626
parser.initialize(HTTPParser.RESPONSE, {});
2727

28-
const socket = net.connect(common.PORT);
28+
const socket = net.connect(common.PORT, common.localhostIPv4);
2929
socket.on('error', (e) => {
3030
// If SmartOS and ECONNREFUSED, then retry. See
3131
// https://github.com/nodejs/node/issues/2663.
@@ -57,7 +57,7 @@ const server = net.createServer(function(c) {
5757
c.end('HTTP/1.1 200 OK\r\n\r\n', function() {
5858
c.destroySoon();
5959
});
60-
}).listen(common.PORT, execAndClose);
60+
}).listen(common.PORT, common.localhostIPv4, execAndClose);
6161

6262
process.on('exit', function() {
6363
assert.strictEqual(gotResponses, COUNT);

0 commit comments

Comments
 (0)