From de3907dd5bd5ff2e6d69c8c17875c1b52321f7f4 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 19 Jun 2019 05:18:02 +0200 Subject: [PATCH 1/2] test: use regex for OpenSSL function name This commit modifies test-crypt-scrypt.js to use a regular expression for the function name in the error message, similar to what is done for the error code. The motivation for this change comes from a case where we (Red Hat) patch OpenSSL and the memory limit checking is done in a different function, meaning that the function name from which this error originates differs from that when linking to the OpenSSL version shipped with Node.js. --- test/parallel/test-crypto-scrypt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js index e1d0ddf10c98f4..3ac4cda339c1a0 100644 --- a/test/parallel/test-crypto-scrypt.js +++ b/test/parallel/test-crypto-scrypt.js @@ -169,7 +169,7 @@ for (const options of bad) { for (const options of toobig) { const expected = { - message: /error:[^:]+:digital envelope routines:EVP_PBE_scrypt:memory limit exceeded/, + message: /error:[^:]+:digital envelope routines:[^:]+:memory limit exceeded/, type: Error, }; common.expectsError(() => crypto.scrypt('pass', 'salt', 1, options, () => {}), From 94153aee307bee1fadc19de75c8c50078cce2e43 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 20 Jun 2019 14:19:15 +0200 Subject: [PATCH 2/2] fixup! add Red Hat specific function to regex --- test/parallel/test-crypto-scrypt.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js index 3ac4cda339c1a0..7c7f089606b852 100644 --- a/test/parallel/test-crypto-scrypt.js +++ b/test/parallel/test-crypto-scrypt.js @@ -169,7 +169,8 @@ for (const options of bad) { for (const options of toobig) { const expected = { - message: /error:[^:]+:digital envelope routines:[^:]+:memory limit exceeded/, + message: new RegExp('error:[^:]+:digital envelope routines:' + + '(?:EVP_PBE_scrypt|scrypt_alg):memory limit exceeded'), type: Error, }; common.expectsError(() => crypto.scrypt('pass', 'salt', 1, options, () => {}),