Skip to content

Commit 0cf9d04

Browse files
apapirovskiMylesBorins
authored andcommitted
test: add test for tls benchmarks
PR-URL: #18489 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f96b0bf commit 0cf9d04

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

benchmark/tls/throughput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ function main(conf) {
4545
};
4646

4747
server = tls.createServer(options, onConnection);
48-
setTimeout(done, dur * 1000);
4948
var conn;
5049
server.listen(common.PORT, function() {
5150
const opt = { port: common.PORT, rejectUnauthorized: false };
5251
conn = tls.connect(opt, function() {
52+
setTimeout(done, dur * 1000);
5353
bench.start();
5454
conn.on('drain', write);
5555
write();

test/sequential/test-benchmark-tls.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
5+
if (!common.enoughTestMem)
6+
common.skip('Insufficient memory for TLS benchmark test');
7+
8+
// Because the TLS benchmarks use hardcoded ports, this should be in sequential
9+
// rather than parallel to make sure it does not conflict with tests that choose
10+
// random available ports.
11+
12+
const runBenchmark = require('../common/benchmark');
13+
14+
runBenchmark('tls',
15+
[
16+
'concurrency=1',
17+
'dur=0.1',
18+
'n=1',
19+
'size=2',
20+
'type=asc'
21+
],
22+
{
23+
NODEJS_BENCHMARK_ZERO_ALLOWED: 1,
24+
duration: 0
25+
});

0 commit comments

Comments
 (0)