Skip to content

Commit 4d68064

Browse files
maclover7jasnell
authored andcommitted
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: #15151 Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent a92f3df commit 4d68064

5 files changed

+6
-4
lines changed

Diff for: β€Žtest/parallel/test-http-agent-uninitialized-with-handle.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ socket._handle = {
1313
ref() { },
1414
readStart() { },
1515
};
16-
const req = new http.ClientRequest(`http://localhost:${common.PORT}/`);
1716

1817
const server = http.createServer(common.mustCall((req, res) => {
1918
res.end();
20-
})).listen(common.PORT, common.mustCall(() => {
19+
})).listen(0, common.mustCall(() => {
20+
const req = new http.ClientRequest(`http://localhost:${server.address().port}/`);
21+
2122
// Manually add the socket without a _handle.
2223
agent.freeSockets[agent.getName(req)] = [socket];
2324
// Now force the agent to use the socket and check that _handle exists before

Diff for: β€Žtest/parallel/test-http-agent-uninitialized.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ const agent = new http.Agent({
88
keepAlive: true,
99
});
1010
const socket = new net.Socket();
11-
const req = new http.ClientRequest(`http://localhost:${common.PORT}/`);
1211

1312
const server = http.createServer(common.mustCall((req, res) => {
1413
res.end();
15-
})).listen(common.PORT, common.mustCall(() => {
14+
})).listen(0, common.mustCall(() => {
15+
const req = new http.ClientRequest(`http://localhost:${server.address().port}/`);
16+
1617
// Manually add the socket without a _handle.
1718
agent.freeSockets[agent.getName(req)] = [socket];
1819
// Now force the agent to use the socket and check that _handle exists before
File renamed without changes.

0 commit comments

Comments
Β (0)