From af15b755c08370d4224541205f9e3e9ff54a4325 Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Fri, 1 Sep 2017 12:37:41 -0400 Subject: [PATCH] test: move common.PORT tests to sequential Reasons: - `test-async-wrap-getasyncid` binds a handle, so move to sequential because port cannot be already in use. - `test-dgram-implicit-bind-failure` requires a hardcoded port number to properly send socket packet. - `test-http-agent-uninitialized-with-handle` requires a hardcoded port number to properly send http request. - `test-http-agent-uninitialized` requires a hardcoded port number to properly send http request. - `test-net-localport` requires a hardcoded port number for assertions. In addition this replaces two common.PORTs with a dynamic port. PR-URL: https://github.com/nodejs/node/pull/15151 Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/parallel/test-http-agent-uninitialized-with-handle.js | 5 +++-- test/parallel/test-http-agent-uninitialized.js | 5 +++-- test/{parallel => sequential}/test-async-wrap-getasyncid.js | 0 .../test-dgram-implicit-bind-failure.js | 0 test/{parallel => sequential}/test-net-localport.js | 0 5 files changed, 6 insertions(+), 4 deletions(-) rename test/{parallel => sequential}/test-async-wrap-getasyncid.js (100%) rename test/{parallel => sequential}/test-dgram-implicit-bind-failure.js (100%) rename test/{parallel => sequential}/test-net-localport.js (100%) diff --git a/test/parallel/test-http-agent-uninitialized-with-handle.js b/test/parallel/test-http-agent-uninitialized-with-handle.js index fab32ade45efe4..77f01771734c87 100644 --- a/test/parallel/test-http-agent-uninitialized-with-handle.js +++ b/test/parallel/test-http-agent-uninitialized-with-handle.js @@ -13,11 +13,12 @@ socket._handle = { ref() { }, readStart() { }, }; -const req = new http.ClientRequest(`http://localhost:${common.PORT}/`); const server = http.createServer(common.mustCall((req, res) => { res.end(); -})).listen(common.PORT, common.mustCall(() => { +})).listen(0, common.mustCall(() => { + const req = new http.ClientRequest(`http://localhost:${server.address().port}/`); + // Manually add the socket without a _handle. agent.freeSockets[agent.getName(req)] = [socket]; // Now force the agent to use the socket and check that _handle exists before diff --git a/test/parallel/test-http-agent-uninitialized.js b/test/parallel/test-http-agent-uninitialized.js index c522b5fdbd43e9..dbb38e3b0f9847 100644 --- a/test/parallel/test-http-agent-uninitialized.js +++ b/test/parallel/test-http-agent-uninitialized.js @@ -8,11 +8,12 @@ const agent = new http.Agent({ keepAlive: true, }); const socket = new net.Socket(); -const req = new http.ClientRequest(`http://localhost:${common.PORT}/`); const server = http.createServer(common.mustCall((req, res) => { res.end(); -})).listen(common.PORT, common.mustCall(() => { +})).listen(0, common.mustCall(() => { + const req = new http.ClientRequest(`http://localhost:${server.address().port}/`); + // Manually add the socket without a _handle. agent.freeSockets[agent.getName(req)] = [socket]; // Now force the agent to use the socket and check that _handle exists before diff --git a/test/parallel/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js similarity index 100% rename from test/parallel/test-async-wrap-getasyncid.js rename to test/sequential/test-async-wrap-getasyncid.js diff --git a/test/parallel/test-dgram-implicit-bind-failure.js b/test/sequential/test-dgram-implicit-bind-failure.js similarity index 100% rename from test/parallel/test-dgram-implicit-bind-failure.js rename to test/sequential/test-dgram-implicit-bind-failure.js diff --git a/test/parallel/test-net-localport.js b/test/sequential/test-net-localport.js similarity index 100% rename from test/parallel/test-net-localport.js rename to test/sequential/test-net-localport.js