Skip to content

Commit a9e11b1

Browse files
committed
[misc] correcting SSL test that now can use TLSv1.3 protocol for MariaDB 10.4
1 parent fbe82aa commit a9e11b1

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

benchmarks/common_benchmarks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ function Bench() {
197197
console.log('start : init test : ' + bench.initFcts.length);
198198
for (let i = 0; i < bench.initFcts.length; i++) {
199199
console.log('initializing test data ' + (i + 1) + '/' + bench.initFcts.length);
200-
if (bench.initFcts[i]) {
200+
if (bench.initFcts[i][0]) {
201201
bench.initFcts[i][0].call(
202202
this,
203-
bench.initFcts[i][0] ? bench.CONN.PROMISE_MARIADB.drv : bench.CONN.MARIADB.drv
203+
bench.initFcts[i][1] ? bench.CONN.PROMISE_MARIADB.drv : bench.CONN.MARIADB.drv
204204
);
205205
}
206206
}

test/integration/test-ssl.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ describe('ssl', function() {
1212

1313
before(function(done) {
1414
if (process.env.MAXSCALE_VERSION) this.skip();
15-
console.log(tls.DEFAULT_MIN_VERSION);
1615
if (
1716
process.platform === 'win32' &&
1817
tls.DEFAULT_MIN_VERSION === 'TLSv1.2' &&
@@ -392,7 +391,7 @@ describe('ssl', function() {
392391
.createConnection({ host: 'mariadb.example.com', ssl: { ca: ca } })
393392
.then(conn => {
394393
const isWin = process.platform === 'win32';
395-
let expectedProtocol = 'TLSv1.2';
394+
let expectedProtocol = ['TLSv1.2', 'TLSv1.3'];
396395
if (shareConn.info.isMariaDB()) {
397396
if (isWin && !shareConn.info.hasMinVersion(10, 4, 0)) {
398397
expectedProtocol = 'TLSv1.1';
@@ -527,7 +526,17 @@ describe('ssl', function() {
527526

528527
function checkProtocol(conn, protocol) {
529528
const ver = process.version.substring(1).split('.');
530-
if (ver[0] > 5 || (ver[0] === 5 && ver[1] === 7)) {
531-
assert.equal(conn.__tests.getSocket().getProtocol(), protocol);
529+
const currentProtocol = conn.__tests.getSocket().getProtocol();
530+
531+
if (ver[0] > 5 || (ver[0] == 5 && ver[1] == 7)) {
532+
if (Array.isArray(protocol)) {
533+
for (let i = 0; i < protocol.length; i++) {
534+
if (currentProtocol === protocol[i]) return;
535+
}
536+
//throw error
537+
assert.equal(currentProtocol, protocol);
538+
return;
539+
}
540+
assert.equal(currentProtocol, protocol);
532541
}
533542
}

0 commit comments

Comments
 (0)