mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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: https://github.com/nodejs/node/pull/49574 Closes: https://github.com/nodejs/node/pull/49565 Fixes: https://github.com/nodejs/node/issues/49564 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
@@ -25,7 +25,7 @@ function execAndClose() {
|
||||
const parser = parsers.pop();
|
||||
parser.initialize(HTTPParser.RESPONSE, {});
|
||||
|
||||
const socket = net.connect(common.PORT);
|
||||
const socket = net.connect(common.PORT, common.localhostIPv4);
|
||||
socket.on('error', (e) => {
|
||||
// If SmartOS and ECONNREFUSED, then retry. See
|
||||
// https://github.com/nodejs/node/issues/2663.
|
||||
@@ -57,7 +57,7 @@ const server = net.createServer(function(c) {
|
||||
c.end('HTTP/1.1 200 OK\r\n\r\n', function() {
|
||||
c.destroySoon();
|
||||
});
|
||||
}).listen(common.PORT, execAndClose);
|
||||
}).listen(common.PORT, common.localhostIPv4, execAndClose);
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.strictEqual(gotResponses, COUNT);
|
||||
|
||||
Reference in New Issue
Block a user