Skip to content

Commit

Permalink
test: use regex for OpenSSL function name
Browse files Browse the repository at this point in the history
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.

PR-URL: #28289
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
danbev authored and targos committed Jul 2, 2019
1 parent f21ddb2 commit 5047006
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/parallel/test-crypto-scrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ for (const options of bad) {

for (const options of toobig) {
const expected = {
message: /error:[^:]+:digital envelope routines:EVP_PBE_scrypt: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, () => {}),
Expand Down

0 comments on commit 5047006

Please sign in to comment.