Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: remove common.PORT from test-tls-connect
Replace common.PORT with 0 to prevent the occurence of
any EADDRINUSE errors.

Refs: #12376
  • Loading branch information
tanuck committed Apr 19, 2017
commit e5171967fb6accbcf3fba450ed9b381bb7cdf08e
4 changes: 2 additions & 2 deletions test/parallel/test-tls-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const path = require('path');
const cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'));
const key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'));

const options = {cert: cert, key: key, port: common.PORT};
const options = {cert: cert, key: key, port: 0};
const conn = tls.connect(options, common.mustNotCall());

conn.on('error', common.mustCall());
Copy link
Copy Markdown
Contributor

@thefourtheye thefourtheye Apr 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you are doing this, it would be better if you could assert the actual error messages. On my machine I got

{ Error: connect ECONNREFUSED 127.0.0.1:12346
    at Object.exports._errnoException (util.js:1042:11)
    at exports._exceptionWithHostPort (util.js:1065:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1115:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 12346 }

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using port: 0 I got the same on Linux, however the error code changes to EADDRNOTAVAIL on OS X for some reason.

Expand All @@ -51,7 +51,7 @@ const path = require('path');
const conn = tls.connect({
cert: cert,
key: key,
port: common.PORT,
port: 0,
ciphers: 'rick-128-roll'
}, common.mustNotCall());

Expand Down