Skip to content

test: fix spurious EADDRINUSE in test-https-strict #7024

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

Closed
wants to merge 1 commit into from
Closed
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
20 changes: 10 additions & 10 deletions test/parallel/test-https-strict.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,9 @@ var server3 = server(options3);

var listenWait = 0;

var port = common.PORT;
var port1 = port++;
var port2 = port++;
var port3 = port++;
server1.listen(port1, listening());
server2.listen(port2, listening());
server3.listen(port3, listening());
server1.listen(0, listening());
server2.listen(0, listening());
server3.listen(0, listening());

var responseErrors = {};
var expectResponseCount = 0;
Expand Down Expand Up @@ -131,9 +127,9 @@ function makeReq(path, port, error, host, ca) {
}
var req = https.get(options);
expectResponseCount++;
var server = port === port1 ? server1
: port === port2 ? server2
: port === port3 ? server3
var server = port === server1.address().port ? server1
: port === server2.address().port ? server2
: port === server3.address().port ? server3
: null;

if (!server) throw new Error('invalid port: ' + port);
Expand All @@ -156,6 +152,10 @@ function makeReq(path, port, error, host, ca) {
function allListening() {
// ok, ready to start the tests!

const port1 = server1.address().port;
const port2 = server2.address().port;
const port3 = server3.address().port;

// server1: host 'agent1', signed by ca1
makeReq('/inv1', port1, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE');
makeReq('/inv1-ca1', port1,
Expand Down