diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index 666624490e79a9e..6a54446ef37039c 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -393,7 +393,7 @@ class NodeInstance extends EventEmitter { console.log('[test]', `Testing ${path}`); const headers = hostHeaderValue ? { 'Host': hostHeaderValue } : null; return this.portPromise.then((port) => new Promise((resolve, reject) => { - const req = http.get({ host, port, path, headers }, (res) => { + const req = http.get({ host, port, family: 4, path, headers }, (res) => { let response = ''; res.setEncoding('utf8'); res @@ -419,6 +419,7 @@ class NodeInstance extends EventEmitter { const port = await this.portPromise; return http.get({ port, + family: 4, path: parseURL(devtoolsUrl).path, headers: { 'Connection': 'Upgrade', diff --git a/test/parallel/test-cluster-message.js b/test/parallel/test-cluster-message.js index 45854c77a5a347e..e49bee6bf0a409c 100644 --- a/test/parallel/test-cluster-message.js +++ b/test/parallel/test-cluster-message.js @@ -111,7 +111,7 @@ if (cluster.isWorker) { // When a TCP server is listening in the worker connect to it worker.on('listening', function(address) { - client = net.connect(address.port, function() { + client = net.connect({ port: address.port, family: 4 }, function() { // Send message to worker. worker.send('message from primary'); }); diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js index e237c3bff1ac848..a0e4bb80a3f8c28 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -42,6 +42,7 @@ const server = http.createServer((req, res) => { server.listen(0, '127.0.0.1', () => { const options = { host: 'localhost', port: server.address().port, + family: 4, path: '/', method: 'GET', localAddress: '127.0.0.2' }; diff --git a/test/parallel/test-http-upgrade-client.js b/test/parallel/test-http-upgrade-client.js index 8fe756f469f09a3..7b5dde540746a6f 100644 --- a/test/parallel/test-http-upgrade-client.js +++ b/test/parallel/test-http-upgrade-client.js @@ -68,6 +68,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() { headers.forEach(function(h) { const req = http.get({ port: port, + family: 4, headers: h }); let sawUpgrade = false; diff --git a/test/parallel/test-http2-connect-options.js b/test/parallel/test-http2-connect-options.js index 0c7ec807b84d38d..233ced016974e27 100644 --- a/test/parallel/test-http2-connect-options.js +++ b/test/parallel/test-http2-connect-options.js @@ -22,7 +22,7 @@ const server = http2.createServer((req, res) => { }); server.listen(0, '127.0.0.1', common.mustCall(() => { - const options = { localAddress: '127.0.0.2' }; + const options = { localAddress: '127.0.0.2', family: 4 }; const client = http2.connect( 'http://localhost:' + server.address().port, diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js index 0ac8414b2d4b357..0de0974dc69b04f 100644 --- a/test/parallel/test-https-localaddress.js +++ b/test/parallel/test-https-localaddress.js @@ -52,6 +52,7 @@ server.listen(0, '127.0.0.1', function() { const options = { host: 'localhost', port: this.address().port, + family: 4, path: '/', method: 'GET', localAddress: '127.0.0.2', diff --git a/test/parallel/test-net-dns-lookup.js b/test/parallel/test-net-dns-lookup.js index 53052de716ee9e1..1ac6525c00d85bd 100644 --- a/test/parallel/test-net-dns-lookup.js +++ b/test/parallel/test-net-dns-lookup.js @@ -29,8 +29,8 @@ const server = net.createServer(function(client) { server.close(); }); -server.listen(0, '127.0.0.1', common.mustCall(function() { - net.connect(this.address().port, 'localhost') +server.listen(0, common.localhostIPv4, common.mustCall(function() { + net.connect({ port: this.address().port, host: 'localhost', family: 4 }) .on('lookup', common.mustCall(function(err, ip, type, host) { assert.strictEqual(err, null); assert.strictEqual(ip, '127.0.0.1'); diff --git a/test/parallel/test-net-remote-address-port.js b/test/parallel/test-net-remote-address-port.js index 094206f85df34da..cc14d0c951167d9 100644 --- a/test/parallel/test-net-remote-address-port.js +++ b/test/parallel/test-net-remote-address-port.js @@ -28,7 +28,7 @@ const net = require('net'); let conns_closed = 0; const remoteAddrCandidates = [ common.localhostIPv4 ]; -if (common.hasIPv6) remoteAddrCandidates.push('::ffff:127.0.0.1'); +if (common.hasIPv6) remoteAddrCandidates.push('::1', '::ffff:127.0.0.1'); const remoteFamilyCandidates = ['IPv4']; if (common.hasIPv6) remoteFamilyCandidates.push('IPv6'); diff --git a/test/parallel/test-tcp-wrap-listen.js b/test/parallel/test-tcp-wrap-listen.js index 72981b683ccea3f..e2e70b627238dd9 100644 --- a/test/parallel/test-tcp-wrap-listen.js +++ b/test/parallel/test-tcp-wrap-listen.js @@ -14,7 +14,9 @@ const { const server = new TCP(TCPConstants.SOCKET); -const r = server.bind('0.0.0.0', 0); +const r = (common.hasIPv6 ? + server.bind6('::', 0) : + server.bind('0.0.0.0', 0)); assert.strictEqual(r, 0); let port = {}; server.getsockname(port); diff --git a/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js b/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js index ccecfe4c63a6a19..5fcd4fa4fee4bc3 100644 --- a/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js +++ b/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js @@ -32,12 +32,12 @@ server.listen(0, common.localhostIPv4, common.mustCall(() => { const countdown = new Countdown(2, () => server.close()); { - const client = net.connect({ port: server.address().port }); + const client = net.connect({ port: server.address().port, family: 4 }); client.on('end', () => countdown.dec()); } { - const client = net.connect({ port: server.address().port }); + const client = net.connect({ port: server.address().port, family: 4 }); client.on('end', () => countdown.dec()); } })); diff --git a/test/parallel/test-tls-client-getephemeralkeyinfo.js b/test/parallel/test-tls-client-getephemeralkeyinfo.js index 73ac215102ddbba..36502da30af8dd8 100644 --- a/test/parallel/test-tls-client-getephemeralkeyinfo.js +++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js @@ -40,6 +40,7 @@ function test(size, type, name, cipher) { server.listen(0, '127.0.0.1', common.mustCall(() => { const client = tls.connect({ port: server.address().port, + family: 4, rejectUnauthorized: false }, common.mustCall(function() { const ekeyinfo = client.getEphemeralKeyInfo(); diff --git a/test/parallel/test-tls-client-mindhsize.js b/test/parallel/test-tls-client-mindhsize.js index a6fbc67bd883615..375501829508d7a 100644 --- a/test/parallel/test-tls-client-mindhsize.js +++ b/test/parallel/test-tls-client-mindhsize.js @@ -41,6 +41,7 @@ function test(size, err, next) { const client = tls.connect({ minDHSize: 2048, port: this.address().port, + family: 4, rejectUnauthorized: false }, function() { nsuccess++; diff --git a/test/parallel/test-tls-wrap-econnreset-localaddress.js b/test/parallel/test-tls-wrap-econnreset-localaddress.js index 30d3a8873fa8f05..b51ddb29ba8b550 100644 --- a/test/parallel/test-tls-wrap-econnreset-localaddress.js +++ b/test/parallel/test-tls-wrap-econnreset-localaddress.js @@ -16,6 +16,7 @@ const server = net.createServer((c) => { let errored = false; tls.connect({ port: port, + family: 4, localAddress: common.localhostIPv4 }, common.localhostIPv4) .once('error', common.mustCall((e) => { diff --git a/test/sequential/test-https-connect-localport.js b/test/sequential/test-https-connect-localport.js index e703fb2287d3692..4062a8ad4e6d5d4 100644 --- a/test/sequential/test-https-connect-localport.js +++ b/test/sequential/test-https-connect-localport.js @@ -23,7 +23,7 @@ const assert = require('assert'); host: 'localhost', pathname: '/', port, - family: 4, + //family: 4, localPort: common.PORT, rejectUnauthorized: false, }, common.mustCall(() => { diff --git a/test/sequential/test-inspector-open.js b/test/sequential/test-inspector-open.js index 190a99e7282e525..847f0ab6926f670 100644 --- a/test/sequential/test-inspector-open.js +++ b/test/sequential/test-inspector-open.js @@ -80,7 +80,7 @@ function reopenAfterClose(msg) { } function ping(port, callback) { - net.connect(port) + net.connect({ port, family: 4 }) .on('connect', function() { close(this); }) .on('error', function(err) { close(this, err); }); diff --git a/test/sequential/test-net-connect-local-error.js b/test/sequential/test-net-connect-local-error.js index 030c4de750cb4d4..7fa33b075975475 100644 --- a/test/sequential/test-net-connect-local-error.js +++ b/test/sequential/test-net-connect-local-error.js @@ -9,6 +9,7 @@ const expectedErrorCodes = ['ECONNREFUSED', 'EADDRINUSE']; const optionsIPv4 = { port: common.PORT, + family: 4, localPort: common.PORT + 1, localAddress: common.localhostIPv4 }; @@ -16,6 +17,7 @@ const optionsIPv4 = { const optionsIPv6 = { host: '::1', port: common.PORT + 2, + family: 6, localPort: common.PORT + 3, localAddress: '::1', };