From b383fdde791d08840f01453ddc080228fe65a4c0 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 28 Jun 2016 17:14:19 -0700 Subject: [PATCH] test: remove common.PORT from http tests PR-URL: https://github.com/nodejs/node/pull/7467 Reviewed-By: Anna Henningsen Reviewed-By: Brian White Reviewed-By: Ben Noordhuis Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- ...t-http-client-keep-alive-release-before-finish.js | 12 +++++++----- test/parallel/test-http-no-read-no-dump.js | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-http-client-keep-alive-release-before-finish.js b/test/parallel/test-http-client-keep-alive-release-before-finish.js index 374bacba3e5362..0efedc91e2613d 100644 --- a/test/parallel/test-http-client-keep-alive-release-before-finish.js +++ b/test/parallel/test-http-client-keep-alive-release-before-finish.js @@ -4,16 +4,18 @@ const http = require('http'); const server = http.createServer((req, res) => { res.end(); -}).listen(common.PORT, common.mustCall(() => { +}).listen(0, common.mustCall(() => { const agent = new http.Agent({ maxSockets: 1, keepAlive: true }); + const port = server.address().port; + const post = http.request({ - agent: agent, + agent, method: 'POST', - port: common.PORT, + port, }, common.mustCall((res) => { res.resume(); })); @@ -28,9 +30,9 @@ const server = http.createServer((req, res) => { }, 100); http.request({ - agent: agent, + agent, method: 'GET', - port: common.PORT, + port, }, common.mustCall((res) => { server.close(); res.connection.end(); diff --git a/test/parallel/test-http-no-read-no-dump.js b/test/parallel/test-http-no-read-no-dump.js index c509146c0a29d7..17d36c56b2eeba 100644 --- a/test/parallel/test-http-no-read-no-dump.js +++ b/test/parallel/test-http-no-read-no-dump.js @@ -15,16 +15,18 @@ const server = http.createServer((req, res) => { res.end(); onPause(); }); -}).listen(common.PORT, common.mustCall(() => { +}).listen(0, common.mustCall(() => { const agent = new http.Agent({ maxSockets: 1, keepAlive: true }); + const port = server.address().port; + const post = http.request({ - agent: agent, + agent, method: 'POST', - port: common.PORT, + port, }, common.mustCall((res) => { res.resume(); @@ -41,9 +43,9 @@ const server = http.createServer((req, res) => { post.write('initial'); http.request({ - agent: agent, + agent, method: 'GET', - port: common.PORT, + port, }, common.mustCall((res) => { server.close(); res.connection.end();