From b4bbddbad372b23c9bfb81741b45a16f349cdb51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 18 Feb 2023 02:16:59 +0000 Subject: [PATCH] test: remove OpenSSL 1.0.2 error message compat While upgrading from OpenSSL 1.0.2 to 1.1.1, these tests were modified to recognize error messages from both OpenSSL releases. Given that OpenSSL 1.0.2 has been unsupported for years, it is safe to remove the older message patterns. Refs: https://github.com/nodejs/node/pull/16130 --- test/parallel/test-tls-junk-server.js | 4 +--- test/parallel/test-tls-no-sslv3.js | 4 +--- .../test-tls-server-failed-handshake-emits-clienterror.js | 3 +-- test/parallel/test-tls-socket-failed-handshake-emits-error.js | 3 +-- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-tls-junk-server.js b/test/parallel/test-tls-junk-server.js index 27c273857b51ff..273fe9def4ecb4 100644 --- a/test/parallel/test-tls-junk-server.js +++ b/test/parallel/test-tls-junk-server.js @@ -21,9 +21,7 @@ server.listen(0, function() { req.end(); req.once('error', common.mustCall(function(err) { - // OpenSSL 1.0.x and 1.1.x use different error messages for junk inputs. - assert(/unknown protocol/.test(err.message) || - /wrong version number/.test(err.message)); + assert(/wrong version number/.test(err.message)); server.close(); })); }); diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js index 4be58752e82bbb..9282beb4bdac2c 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -42,8 +42,6 @@ process.on('exit', function() { common.printSkipMessage('`openssl s_client -ssl3` not supported.'); } else { assert.strictEqual(errors.length, 1); - // OpenSSL 1.0.x and 1.1.x report invalid client versions differently. - assert(/:wrong version number/.test(errors[0].message) || - /:version too low/.test(errors[0].message)); + assert(/:version too low/.test(errors[0].message)); } }); diff --git a/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js b/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js index c4351008c147c9..31e0e349489878 100644 --- a/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js +++ b/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js @@ -20,9 +20,8 @@ const server = tls.createServer({}) }).on('tlsClientError', common.mustCall(function(e) { assert.ok(e instanceof Error, 'Instance of Error should be passed to error handler'); - // OpenSSL 1.0.x and 1.1.x use different error codes for junk inputs. assert.ok( - /SSL routines:[^:]*:(unknown protocol|wrong version number)/.test( + /SSL routines:[^:]*:wrong version number/.test( e.message), 'Expecting SSL unknown protocol'); diff --git a/test/parallel/test-tls-socket-failed-handshake-emits-error.js b/test/parallel/test-tls-socket-failed-handshake-emits-error.js index d67a5498d65195..d43a8c7f14d2ba 100644 --- a/test/parallel/test-tls-socket-failed-handshake-emits-error.js +++ b/test/parallel/test-tls-socket-failed-handshake-emits-error.js @@ -20,9 +20,8 @@ const server = net.createServer(function(c) { s.on('error', common.mustCall(function(e) { assert.ok(e instanceof Error, 'Instance of Error should be passed to error handler'); - // OpenSSL 1.0.x and 1.1.x use different error codes for junk inputs. assert.ok( - /SSL routines:[^:]*:(unknown protocol|wrong version number)/.test( + /SSL routines:[^:]*:wrong version number/.test( e.message), 'Expecting SSL unknown protocol'); }));