Skip to content

Commit b48f13a

Browse files
TrottMylesBorins
authored andcommitted
test: add minimal test for net benchmarks
Currently, benchmark code is not exercised at all in CI. This adds a minimal test for net benchmarks. If this is deemed acceptable, similar minimal tests for other benchmarks can be written. Additionally, as issues and edge cases are uncovered, checks for them can be added. PR-URL: #11979 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 764a00e commit b48f13a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/sequential/test-benchmark-net.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
require('../common');
4+
5+
// Minimal test for net benchmarks. This makes sure the benchmarks aren't
6+
// horribly broken but nothing more than that.
7+
8+
// Because the net 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 assert = require('assert');
13+
const fork = require('child_process').fork;
14+
const path = require('path');
15+
16+
const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js');
17+
18+
const child = fork(runjs, ['--set', 'dur=0', 'net']);
19+
child.on('exit', (code, signal) => {
20+
assert.strictEqual(code, 0);
21+
assert.strictEqual(signal, null);
22+
});

0 commit comments

Comments
 (0)