mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
test: fallback to IPv4 if IPv6 is unavailable
openssl seems to default to use IPv6. This change adds a checks if IPv6 is unavailable and uses IPv4 instead. On the Node.js CI IBM i build system IPv6 is currently disabled. This change should resolve the following test case failures: - https://ci.nodejs.org/job/node-test-commit-ibmi/nodes=ibmi73-ppc64/1085/testReport/(root)/test/sequential_test_tls_psk_client_/ - https://ci.nodejs.org/job/node-test-commit-ibmi/nodes=ibmi73-ppc64/1085/testReport/(root)/test/sequential_test_tls_securepair_client_/ PR-URL: https://github.com/nodejs/node/pull/47017 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
parent
359172868f
commit
5012ab4e86
@ -14,6 +14,7 @@ const { spawn } = require('child_process');
|
||||
const CIPHERS = 'PSK+HIGH';
|
||||
const KEY = 'd731ef57be09e5204f0b205b60627028';
|
||||
const IDENTITY = 'Client_identity'; // Hardcoded by `openssl s_server`
|
||||
const useIPv4 = !common.hasIPv6;
|
||||
|
||||
const server = spawn(common.opensslCli, [
|
||||
's_server',
|
||||
@ -23,6 +24,7 @@ const server = spawn(common.opensslCli, [
|
||||
'-psk_hint', IDENTITY,
|
||||
'-nocert',
|
||||
'-rev',
|
||||
...(useIPv4 ? ['-4'] : []),
|
||||
], { encoding: 'utf8' });
|
||||
let serverErr = '';
|
||||
let serverOut = '';
|
||||
|
||||
@ -38,6 +38,8 @@ const fixtures = require('../common/fixtures');
|
||||
const tls = require('tls');
|
||||
const spawn = require('child_process').spawn;
|
||||
|
||||
const useIPv4 = !common.hasIPv6;
|
||||
|
||||
test1();
|
||||
|
||||
// simple/test-tls-securepair-client
|
||||
@ -64,7 +66,9 @@ function test(keyPath, certPath, check, next) {
|
||||
const server = spawn(common.opensslCli, ['s_server',
|
||||
'-accept', 0,
|
||||
'-cert', fixtures.path(certPath),
|
||||
'-key', fixtures.path(keyPath)]);
|
||||
'-key', fixtures.path(keyPath),
|
||||
...(useIPv4 ? ['-4'] : []),
|
||||
]);
|
||||
server.stdout.pipe(process.stdout);
|
||||
server.stderr.pipe(process.stdout);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user