Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove common.PORT from test-tls-connect #12508

Closed
wants to merge 1 commit into from
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
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
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
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