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 <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent a3f272e commit 0edaf01

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const { spawn } = require('child_process');
1414
constCIPHERS='PSK+HIGH';
1515
constKEY='d731ef57be09e5204f0b205b60627028';
1616
constIDENTITY='Client_identity';// Hardcoded by `openssl s_server`
17+
constuseIPv4=!common.hasIPv6;
1718

1819
constserver=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
letserverErr='';
2830
letserverOut='';

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const fixtures = require('../common/fixtures');
3838
consttls=require('tls');
3939
constspawn=require('child_process').spawn;
4040

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

4345
// simple/test-tls-securepair-client
@@ -64,7 +66,9 @@ function test(keyPath, certPath, check, next) {
6466
constserver=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)