From ba340a0ddb7196dff74c20722e45d1c6dcefb17c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sat, 11 Mar 2023 14:52:43 +0100 Subject: [PATCH] test: move `test-tls-autoselectfamily-servername` to `test/internet` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And switch from `google.com` to `nodejs.org`. PR-URL: https://github.com/nodejs/node/pull/47029 Reviewed-By: Moshe Atlow Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Richard Lau Reviewed-By: Paolo Insogna Reviewed-By: Tobias Nießen --- .../test-tls-autoselectfamily-servername.js | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test/internet/test-tls-autoselectfamily-servername.js diff --git a/test/internet/test-tls-autoselectfamily-servername.js b/test/internet/test-tls-autoselectfamily-servername.js new file mode 100644 index 00000000000000..ae53875b677821 --- /dev/null +++ b/test/internet/test-tls-autoselectfamily-servername.js @@ -0,0 +1,38 @@ +'use strict'; + +const common = require('../common'); +const { addresses: { INET_HOST } } = require('../common/internet'); + +if (!common.hasCrypto) { + common.skip('missing crypto'); +} + +const { setDefaultAutoSelectFamilyAttemptTimeout } = require('net'); +const { connect } = require('tls'); + +// Some of the windows machines in the CI need more time to establish connection +setDefaultAutoSelectFamilyAttemptTimeout(common.platformTimeout(common.isWindows ? 1500 : 250)); + +// Test that TLS connecting works without autoSelectFamily +{ + const socket = connect({ + host: INET_HOST, + port: 443, + servername: INET_HOST, + autoSelectFamily: false, + }); + + socket.on('secureConnect', common.mustCall(() => socket.end())); +} + +// Test that TLS connecting works with autoSelectFamily +{ + const socket = connect({ + host: INET_HOST, + port: 443, + servername: INET_HOST, + autoSelectFamily: true, + }); + + socket.on('secureConnect', common.mustCall(() => socket.end())); +}