test: add test for tls benchmarks
PR-URL: https://github.com/nodejs/node/pull/18489 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
6d84ecefcd
commit
5c2c412f21
@ -40,11 +40,11 @@ function main({ dur, type, size }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
server = tls.createServer(options, onConnection);
|
server = tls.createServer(options, onConnection);
|
||||||
setTimeout(done, dur * 1000);
|
|
||||||
var conn;
|
var conn;
|
||||||
server.listen(common.PORT, function() {
|
server.listen(common.PORT, function() {
|
||||||
const opt = { port: common.PORT, rejectUnauthorized: false };
|
const opt = { port: common.PORT, rejectUnauthorized: false };
|
||||||
conn = tls.connect(opt, function() {
|
conn = tls.connect(opt, function() {
|
||||||
|
setTimeout(done, dur * 1000);
|
||||||
bench.start();
|
bench.start();
|
||||||
conn.on('drain', write);
|
conn.on('drain', write);
|
||||||
write();
|
write();
|
||||||
|
25
test/sequential/test-benchmark-tls.js
Normal file
25
test/sequential/test-benchmark-tls.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const common = require('../common');
|
||||||
|
|
||||||
|
if (!common.enoughTestMem)
|
||||||
|
common.skip('Insufficient memory for TLS benchmark test');
|
||||||
|
|
||||||
|
// Because the TLS benchmarks use hardcoded ports, this should be in sequential
|
||||||
|
// rather than parallel to make sure it does not conflict with tests that choose
|
||||||
|
// random available ports.
|
||||||
|
|
||||||
|
const runBenchmark = require('../common/benchmark');
|
||||||
|
|
||||||
|
runBenchmark('tls',
|
||||||
|
[
|
||||||
|
'concurrency=1',
|
||||||
|
'dur=0.1',
|
||||||
|
'n=1',
|
||||||
|
'size=2',
|
||||||
|
'type=asc'
|
||||||
|
],
|
||||||
|
{
|
||||||
|
NODEJS_BENCHMARK_ZERO_ALLOWED: 1,
|
||||||
|
duration: 0
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user