Skip to content

Commit

Permalink
test: move common.PORT tests to sequential
Browse files Browse the repository at this point in the history
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 <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
maclover7 authored and jasnell committed Sep 20, 2017
1 parent a92f3df commit 4d68064
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions test/parallel/test-http-agent-uninitialized-with-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-http-agent-uninitialized.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.

0 comments on commit 4d68064

Please sign in to comment.