Skip to content

Commit

Permalink
dns: fix test suite part 2
Browse files Browse the repository at this point in the history
PR-URL: #39987
Fixes: #31566
Refs: #6307
Refs: #20710
Refs: #38099
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
treysis authored and nodejs-github-bot committed Sep 12, 2021
1 parent 9da76fd commit cd17314
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions test/parallel/test-http-localaddress.js
Expand Up @@ -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' };
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-upgrade-client.js
Expand Up @@ -49,7 +49,7 @@ const server = net.createServer(function(c) {
});
});

server.listen(0, '127.0.0.1', common.mustCall(function() {
server.listen(0, common.mustCall(function() {
const port = this.address().port;
const headers = [
{
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http2-connect-options.js
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-https-localaddress.js
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-net-dns-lookup.js
Expand Up @@ -29,7 +29,7 @@ const server = net.createServer(function(client) {
server.close();
});

server.listen(0, '127.0.0.1', common.mustCall(function() {
server.listen(0, common.mustCall(function() {
net.connect(this.address().port, 'localhost')
.on('lookup', common.mustCall(function(err, ip, type, host) {
assert.strictEqual(err, null);
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-net-remote-address-port.js
Expand Up @@ -48,8 +48,8 @@ const server = net.createServer(common.mustCall(function(socket) {
socket.resume();
}, 2));

server.listen(0, 'localhost', function() {
const client = net.createConnection(this.address().port, 'localhost');
server.listen(0, function() {
const client = net.createConnection(this.address().port, '127.0.0.1');
const client2 = net.createConnection(this.address().port);
client.on('connect', function() {
assert.ok(remoteAddrCandidates.includes(client.remoteAddress));
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-tcp-wrap-listen.js
Expand Up @@ -14,7 +14,7 @@ const {

const server = new TCP(TCPConstants.SOCKET);

const r = server.bind('0.0.0.0', 0);
const r = server.bind(0);
assert.strictEqual(r, 0);
let port = {};
server.getsockname(port);
Expand Down
Expand Up @@ -28,7 +28,7 @@ const server = net.createServer(function onClient(client) {
}
});

server.listen(0, common.localhostIPv4, common.mustCall(() => {
server.listen(0, common.mustCall(() => {
const countdown = new Countdown(2, () => server.close());

{
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-tls-client-getephemeralkeyinfo.js
Expand Up @@ -37,7 +37,7 @@ function test(size, type, name, cipher) {

server.on('close', common.mustSucceed());

server.listen(0, '127.0.0.1', common.mustCall(() => {
server.listen(0, common.mustCall(() => {
const client = tls.connect({
port: server.address().port,
rejectUnauthorized: false
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-tls-client-mindhsize.js
Expand Up @@ -34,7 +34,7 @@ function test(size, err, next) {
if (next) next();
});

server.listen(0, '127.0.0.1', function() {
server.listen(0, function() {
// Client set minimum DH parameter size to 2048 bits so that
// it fails when it make a connection to the tls server where
// dhparams is 1024 bits
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-tls-wrap-econnreset-localaddress.js
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-http-upload-timeout.js
Expand Up @@ -44,7 +44,7 @@ server.on('request', function(req, res) {
req.resume();
});

server.listen(0, '127.0.0.1', function() {
server.listen(0, function() {
for (let i = 0; i < 10; i++) {
connections++;

Expand Down
3 changes: 2 additions & 1 deletion test/pummel/test-net-pingpong.js
Expand Up @@ -38,7 +38,8 @@ function pingPongTest(host, on_complete) {
if (host === '127.0.0.1') {
assert.strictEqual(address, '127.0.0.1');
} else if (host == null || host === 'localhost') {
assert(address === '127.0.0.1' || address === '::ffff:127.0.0.1');
assert(address === '127.0.0.1' || address === '::ffff:127.0.0.1'
|| address === '::1');
} else {
console.log(`host = ${host}, remoteAddress = ${address}`);
assert.strictEqual(address, '::1');
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-inspector-open.js
Expand Up @@ -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); });

Expand Down

0 comments on commit cd17314

Please sign in to comment.