Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix flaky IPv6/localhost tests #7522

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ test-tick-processor : PASS,FLAKY
[$system==linux]
test-tick-processor : PASS,FLAKY

# Flaky until https://github.com/nodejs/build/issues/415 is resolved.
# On some of the buildbots, AAAA queries for localhost don't resolve
# to an address and neither do any of the alternatives from the
# localIPv6Hosts list from test/common.js.
test-https-connect-address-family : PASS,FLAKY
test-tls-connect-address-family : PASS,FLAKY

[$system==macos]

[$system==solaris] # Also applies to SmartOS
Expand Down
20 changes: 10 additions & 10 deletions test/parallel/test-https-connect-address-family.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ if (!common.hasCrypto) {
return;
}

const assert = require('assert');
const https = require('https');

if (!common.hasIPv6) {
common.skip('no IPv6 support');
return;
}

const assert = require('assert');
const https = require('https');

const ciphers = 'AECDH-NULL-SHA';
https.createServer({ ciphers }, function(req, res) {
https.createServer({ ciphers }, common.mustCall(function(req, res) {
this.close();
res.end();
}).listen(common.PORT, '::1', function() {
})).listen(common.PORT, '::1', common.mustCall(function() {
const options = {
host: 'localhost',
host: '::1',
port: common.PORT,
family: 6,
ciphers: ciphers,
ciphers,
rejectUnauthorized: false,
};
// Will fail with ECONNREFUSED if the address family is not honored.
https.get(options, common.mustCall(function() {
https.get(options, common.mustCall(common.mustCall(function() {
assert.strictEqual('::1', this.socket.remoteAddress);
this.destroy();
}));
});
})));
}));
16 changes: 8 additions & 8 deletions test/parallel/test-tls-connect-address-family.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ if (!common.hasCrypto) {
return;
}

const assert = require('assert');
const tls = require('tls');

if (!common.hasIPv6) {
common.skip('no IPv6 support');
return;
}

const assert = require('assert');
const tls = require('tls');

const ciphers = 'AECDH-NULL-SHA';
tls.createServer({ ciphers }, function() {
tls.createServer({ ciphers }, common.mustCall(function() {
this.close();
}).listen(common.PORT, '::1', function() {
})).listen(common.PORT, '::1', common.mustCall(function() {
const options = {
host: 'localhost',
host: '::1',
port: common.PORT,
family: 6,
ciphers: ciphers,
ciphers,
rejectUnauthorized: false,
};
// Will fail with ECONNREFUSED if the address family is not honored.
tls.connect(options).once('secureConnect', common.mustCall(function() {
assert.strictEqual('::1', this.remoteAddress);
this.destroy();
}));
});
}));