GeezerVison is showing github.com — test: move `test-tls-autoselectfamily-servername` to `test/internet` · nodejs/node@ba340a0
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +38Lines changed: 38 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +const common = require('../common'); |
| 4 | +const { addresses: { INET_HOST } } = require('../common/internet'); |
| 5 | + |
| 6 | +if (!common.hasCrypto) { |
| 7 | + common.skip('missing crypto'); |
| 8 | +} |
| 9 | + |
| 10 | +const { setDefaultAutoSelectFamilyAttemptTimeout } = require('net'); |
| 11 | +const { connect } = require('tls'); |
| 12 | + |
| 13 | +// Some of the windows machines in the CI need more time to establish connection |
| 14 | +setDefaultAutoSelectFamilyAttemptTimeout(common.platformTimeout(common.isWindows ? 1500 : 250)); |
| 15 | + |
| 16 | +// Test that TLS connecting works without autoSelectFamily |
| 17 | +{ |
| 18 | + const socket = connect({ |
| 19 | + host: INET_HOST, |
| 20 | + port: 443, |
| 21 | + servername: INET_HOST, |
| 22 | + autoSelectFamily: false, |
| 23 | + }); |
| 24 | + |
| 25 | + socket.on('secureConnect', common.mustCall(() => socket.end())); |
| 26 | +} |
| 27 | + |
| 28 | +// Test that TLS connecting works with autoSelectFamily |
| 29 | +{ |
| 30 | + const socket = connect({ |
| 31 | + host: INET_HOST, |
| 32 | + port: 443, |
| 33 | + servername: INET_HOST, |
| 34 | + autoSelectFamily: true, |
| 35 | + }); |
| 36 | + |
| 37 | + socket.on('secureConnect', common.mustCall(() => socket.end())); |
| 38 | +} |