Browse Source

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: https://github.com/nodejs/node/pull/15151
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
canary-base
Jon Moss 7 years ago
committed by Ruben Bridgewater
parent
commit
af15b755c0
No known key found for this signature in database GPG Key ID: F07496B3EB3C1762
  1. 5
      test/parallel/test-http-agent-uninitialized-with-handle.js
  2. 5
      test/parallel/test-http-agent-uninitialized.js
  3. 0
      test/sequential/test-async-wrap-getasyncid.js
  4. 0
      test/sequential/test-dgram-implicit-bind-failure.js
  5. 0
      test/sequential/test-net-localport.js

5
test/parallel/test-http-agent-uninitialized-with-handle.js

@ -13,11 +13,12 @@ socket._handle = {
ref() { }, ref() { },
readStart() { }, readStart() { },
}; };
const req = new http.ClientRequest(`http://localhost:${common.PORT}/`);
const server = http.createServer(common.mustCall((req, res) => { const server = http.createServer(common.mustCall((req, res) => {
res.end(); 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. // Manually add the socket without a _handle.
agent.freeSockets[agent.getName(req)] = [socket]; agent.freeSockets[agent.getName(req)] = [socket];
// Now force the agent to use the socket and check that _handle exists before // Now force the agent to use the socket and check that _handle exists before

5
test/parallel/test-http-agent-uninitialized.js

@ -8,11 +8,12 @@ const agent = new http.Agent({
keepAlive: true, keepAlive: true,
}); });
const socket = new net.Socket(); const socket = new net.Socket();
const req = new http.ClientRequest(`http://localhost:${common.PORT}/`);
const server = http.createServer(common.mustCall((req, res) => { const server = http.createServer(common.mustCall((req, res) => {
res.end(); 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. // Manually add the socket without a _handle.
agent.freeSockets[agent.getName(req)] = [socket]; agent.freeSockets[agent.getName(req)] = [socket];
// Now force the agent to use the socket and check that _handle exists before // Now force the agent to use the socket and check that _handle exists before

0
test/parallel/test-async-wrap-getasyncid.js → test/sequential/test-async-wrap-getasyncid.js

0
test/parallel/test-dgram-implicit-bind-failure.js → test/sequential/test-dgram-implicit-bind-failure.js

0
test/parallel/test-net-localport.js → test/sequential/test-net-localport.js

Loading…
Cancel
Save