Skip to content

Commit 0d390f7

Browse files
apapirovskiMylesBorins
authored andcommitted
test: add test for tls benchmarks
PR-URL: #18489 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 958f5ed commit 0d390f7

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
@@ -40,11 +40,11 @@ function main({ dur, type, size }) {
4040
};
4141

4242
server = tls.createServer(options, onConnection);
43-
setTimeout(done, dur * 1000);
4443
var conn;
4544
server.listen(common.PORT, function() {
4645
const opt = { port: common.PORT, rejectUnauthorized: false };
4746
conn = tls.connect(opt, function() {
47+
setTimeout(done, dur * 1000);
4848
bench.start();
4949
conn.on('drain', write);
5050
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)