diff --git a/test/async-hooks/test-graph.tcp.js b/test/async-hooks/test-graph.tcp.js index c2458ef1def769..c2253486ee651e 100644 --- a/test/async-hooks/test-graph.tcp.js +++ b/test/async-hooks/test-graph.tcp.js @@ -15,7 +15,7 @@ const server = net .createServer(common.mustCall(onconnection)) .on('listening', common.mustCall(onlistening)); -server.listen(common.PORT); +server.listen(0); net.connect({ port: server.address().port, host: '::1' }, common.mustCall(onconnected)); diff --git a/test/async-hooks/test-graph.tls-write.js b/test/async-hooks/test-graph.tls-write.js index 0c725d153d731b..26fe1ce41e955c 100644 --- a/test/async-hooks/test-graph.tls-write.js +++ b/test/async-hooks/test-graph.tls-write.js @@ -25,14 +25,14 @@ const server = tls }) .on('listening', common.mustCall(onlistening)) .on('secureConnection', common.mustCall(onsecureConnection)) - .listen(common.PORT); + .listen(0); function onlistening() { // // Creating client and connecting it to server // tls - .connect(common.PORT, { rejectUnauthorized: false }) + .connect(server.address().port, { rejectUnauthorized: false }) .on('secureConnect', common.mustCall(onsecureConnect)); } diff --git a/test/async-hooks/test-tcpwrap.js b/test/async-hooks/test-tcpwrap.js index e7d879caf70551..f3100aba0f0aaa 100644 --- a/test/async-hooks/test-tcpwrap.js +++ b/test/async-hooks/test-tcpwrap.js @@ -24,7 +24,7 @@ const server = net // Calling server.listen creates a TCPWRAP synchronously { - server.listen(common.PORT); + server.listen(0); const tcpsservers = hooks.activitiesOfTypes('TCPSERVERWRAP'); const tcpconnects = hooks.activitiesOfTypes('TCPCONNECTWRAP'); assert.strictEqual(tcpsservers.length, 1); diff --git a/test/async-hooks/test-writewrap.js b/test/async-hooks/test-writewrap.js index 65f7b6175fb63a..d349f635665ddd 100644 --- a/test/async-hooks/test-writewrap.js +++ b/test/async-hooks/test-writewrap.js @@ -23,7 +23,7 @@ const server = tls }) .on('listening', common.mustCall(onlistening)) .on('secureConnection', common.mustCall(onsecureConnection)) - .listen(common.PORT); + .listen(0); assert.strictEqual(hooks.activitiesOfTypes('WRITEWRAP').length, 0); @@ -33,7 +33,7 @@ function onlistening() { // Creating client and connecting it to server // tls - .connect(common.PORT, { rejectUnauthorized: false }) + .connect(server.address().port, { rejectUnauthorized: false }) .on('secureConnect', common.mustCall(onsecureConnect)); assert.strictEqual(hooks.activitiesOfTypes('WRITEWRAP').length, 0); diff --git a/test/parallel/test-net-connect-immediate-finish.js b/test/parallel/test-net-connect-immediate-finish.js index 9adf8c31128b00..27d988ab5af45f 100644 --- a/test/parallel/test-net-connect-immediate-finish.js +++ b/test/parallel/test-net-connect-immediate-finish.js @@ -38,9 +38,9 @@ const { const client = net.connect({ host: addresses.INVALID_HOST, - port: common.PORT, + port: 80, // port number doesn't matter because host name is invalid lookup: common.mustCall(errorLookupMock()) -}); +}, common.mustNotCall()); client.once('error', common.mustCall((err) => { assert(err); diff --git a/test/parallel/test-tls-connect.js b/test/sequential/test-tls-connect.js similarity index 100% rename from test/parallel/test-tls-connect.js rename to test/sequential/test-tls-connect.js diff --git a/test/parallel/test-tls-lookup.js b/test/sequential/test-tls-lookup.js similarity index 100% rename from test/parallel/test-tls-lookup.js rename to test/sequential/test-tls-lookup.js