diff options
author | Rich Trott <rtrott@gmail.com> | 2017-11-22 14:39:38 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-12-05 00:07:27 -0800 |
commit | e18390032e6cdf35c0a62e0c6da8c6d53b8c4f38 (patch) | |
tree | 70ae08309284ec937ac4068a918423608bb03f5e /test/sequential/test-tls-lookup.js | |
parent | 35c01d84a837c4f57b0bac04e27c58c86d2f8c91 (diff) | |
download | android-node-v8-e18390032e6cdf35c0a62e0c6da8c6d53b8c4f38.tar.gz android-node-v8-e18390032e6cdf35c0a62e0c6da8c6d53b8c4f38.tar.bz2 android-node-v8-e18390032e6cdf35c0a62e0c6da8c6d53b8c4f38.zip |
test: remove common.PORT from parallel tests
`common.PORT` should not be used in parallel tests because another test
may experience a collision with `common.PORT` when using port 0 to get
an open port. This has been observed to result in test failures in CI.
PR-URL: https://github.com/nodejs/node/pull/17410
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Lance Ball <lball@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'test/sequential/test-tls-lookup.js')
-rw-r--r-- | test/sequential/test-tls-lookup.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/sequential/test-tls-lookup.js b/test/sequential/test-tls-lookup.js new file mode 100644 index 0000000000..fddbb20ee0 --- /dev/null +++ b/test/sequential/test-tls-lookup.js @@ -0,0 +1,36 @@ +'use strict'; +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +const assert = require('assert'); +const tls = require('tls'); + +['foobar', 1, {}, []].forEach(function connectThrows(input) { + const opts = { + host: 'localhost', + port: common.PORT, + lookup: input + }; + + assert.throws(function() { + tls.connect(opts); + }, common.expectsError({ + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + })); +}); + +connectDoesNotThrow(common.mustCall(() => {})); + +function connectDoesNotThrow(input) { + const opts = { + host: 'localhost', + port: common.PORT, + lookup: input + }; + + assert.doesNotThrow(function() { + tls.connect(opts); + }); +} |