Skip to content

Commit 8273824

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
test: remove common.PORT from http tests
PR-URL: #7467 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 066cefb commit 8273824

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

test/parallel/test-http-client-keep-alive-release-before-finish.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ const http = require('http');
44

55
const server = http.createServer((req, res) => {
66
res.end();
7-
}).listen(common.PORT, common.mustCall(() => {
7+
}).listen(0, common.mustCall(() => {
88
const agent = new http.Agent({
99
maxSockets: 1,
1010
keepAlive: true
1111
});
1212

13+
const port = server.address().port;
14+
1315
const post = http.request({
14-
agent: agent,
16+
agent,
1517
method: 'POST',
16-
port: common.PORT,
18+
port,
1719
}, common.mustCall((res) => {
1820
res.resume();
1921
}));
@@ -28,9 +30,9 @@ const server = http.createServer((req, res) => {
2830
}, 100);
2931

3032
http.request({
31-
agent: agent,
33+
agent,
3234
method: 'GET',
33-
port: common.PORT,
35+
port,
3436
}, common.mustCall((res) => {
3537
server.close();
3638
res.connection.end();

test/parallel/test-http-no-read-no-dump.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ const server = http.createServer((req, res) => {
1515
res.end();
1616
onPause();
1717
});
18-
}).listen(common.PORT, common.mustCall(() => {
18+
}).listen(0, common.mustCall(() => {
1919
const agent = new http.Agent({
2020
maxSockets: 1,
2121
keepAlive: true
2222
});
2323

24+
const port = server.address().port;
25+
2426
const post = http.request({
25-
agent: agent,
27+
agent,
2628
method: 'POST',
27-
port: common.PORT,
29+
port,
2830
}, common.mustCall((res) => {
2931
res.resume();
3032

@@ -41,9 +43,9 @@ const server = http.createServer((req, res) => {
4143
post.write('initial');
4244

4345
http.request({
44-
agent: agent,
46+
agent,
4547
method: 'GET',
46-
port: common.PORT,
48+
port,
4749
}, common.mustCall((res) => {
4850
server.close();
4951
res.connection.end();

0 commit comments

Comments
 (0)