Skip to content

Commit

Permalink
test: remove common.PORT from http tests
Browse files Browse the repository at this point in the history
PR-URL: #7467
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and Myles Borins committed Jul 14, 2016
1 parent 066cefb commit 8273824
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}));
Expand All @@ -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();
Expand Down
12 changes: 7 additions & 5 deletions test/parallel/test-http-no-read-no-dump.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
Expand Down

0 comments on commit 8273824

Please sign in to comment.