Skip to content

Commit 0edaf01

Browse files
abmussedanielleadams
authored andcommitted
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: #47017 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent a3f272e commit 0edaf01

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

test/sequential/test-tls-psk-client.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const { spawn } = require('child_process');
1414
const CIPHERS = 'PSK+HIGH';
1515
const KEY = 'd731ef57be09e5204f0b205b60627028';
1616
const IDENTITY = 'Client_identity'; // Hardcoded by `openssl s_server`
17+
const useIPv4 = !common.hasIPv6;
1718

1819
const server = spawn(common.opensslCli, [
1920
's_server',
@@ -23,6 +24,7 @@ const server = spawn(common.opensslCli, [
2324
'-psk_hint', IDENTITY,
2425
'-nocert',
2526
'-rev',
27+
...(useIPv4 ? ['-4'] : []),
2628
], { encoding: 'utf8' });
2729
let serverErr = '';
2830
let serverOut = '';

test/sequential/test-tls-securepair-client.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const fixtures = require('../common/fixtures');
3838
const tls = require('tls');
3939
const spawn = require('child_process').spawn;
4040

41+
const useIPv4 = !common.hasIPv6;
42+
4143
test1();
4244

4345
// simple/test-tls-securepair-client
@@ -64,7 +66,9 @@ function test(keyPath, certPath, check, next) {
6466
const server = spawn(common.opensslCli, ['s_server',
6567
'-accept', 0,
6668
'-cert', fixtures.path(certPath),
67-
'-key', fixtures.path(keyPath)]);
69+
'-key', fixtures.path(keyPath),
70+
...(useIPv4 ? ['-4'] : []),
71+
]);
6872
server.stdout.pipe(process.stdout);
6973
server.stderr.pipe(process.stdout);
7074

0 commit comments

Comments
 (0)