mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: adjust tls test for OpenSSL32
Refs: https://github.com/nodejs/node/issues/53382 Looks like test is forcing an error through bad data and the error code we get is different for OpenSSL32. Adjust test to cope with the variation across versions. Signed-off-by: Michael Dawson <midawson@redhat.com> PR-URL: https://github.com/nodejs/node/pull/54909 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
c6f514c7ab
commit
a65105ec28
@ -31,10 +31,17 @@ const max_iter = 20;
|
||||
let iter = 0;
|
||||
|
||||
const errorHandler = common.mustCall((err) => {
|
||||
assert.strictEqual(err.code, 'ERR_SSL_WRONG_VERSION_NUMBER');
|
||||
let expectedErrorCode = 'ERR_SSL_WRONG_VERSION_NUMBER';
|
||||
let expectedErrorReason = 'wrong version number';
|
||||
if (common.hasOpenSSL(3, 2)) {
|
||||
expectedErrorCode = 'ERR_SSL_PACKET_LENGTH_TOO_LONG';
|
||||
expectedErrorReason = 'packet length too long';
|
||||
};
|
||||
|
||||
assert.strictEqual(err.code, expectedErrorCode);
|
||||
assert.strictEqual(err.library, 'SSL routines');
|
||||
if (!common.hasOpenSSL3) assert.strictEqual(err.function, 'ssl3_get_record');
|
||||
assert.strictEqual(err.reason, 'wrong version number');
|
||||
assert.strictEqual(err.reason, expectedErrorReason);
|
||||
errorReceived = true;
|
||||
if (canCloseServer())
|
||||
server.close();
|
||||
@ -87,10 +94,16 @@ function sendBADTLSRecord() {
|
||||
});
|
||||
}));
|
||||
client.on('error', common.mustCall((err) => {
|
||||
assert.strictEqual(err.code, 'ERR_SSL_TLSV1_ALERT_PROTOCOL_VERSION');
|
||||
let expectedErrorCode = 'ERR_SSL_TLSV1_ALERT_PROTOCOL_VERSION';
|
||||
let expectedErrorReason = 'tlsv1 alert protocol version';
|
||||
if (common.hasOpenSSL(3, 2)) {
|
||||
expectedErrorCode = 'ERR_SSL_TLSV1_ALERT_RECORD_OVERFLOW';
|
||||
expectedErrorReason = 'tlsv1 alert record overflow';
|
||||
}
|
||||
assert.strictEqual(err.code, expectedErrorCode);
|
||||
assert.strictEqual(err.library, 'SSL routines');
|
||||
if (!common.hasOpenSSL3)
|
||||
assert.strictEqual(err.function, 'ssl3_read_bytes');
|
||||
assert.strictEqual(err.reason, 'tlsv1 alert protocol version');
|
||||
assert.strictEqual(err.reason, expectedErrorReason);
|
||||
}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user