Skip to content

Commit 779ce29

Browse files
Trottaddaleax
authored andcommitted
test: add check for wrk to test-keep-alive
test/pummel/test-keep-alive.js requires `wrk` to be installed. Check if it is, and skip the test if it isn't. This is yet another step in preparation for running pummel tests in CI daily. PR-URL: #25516 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 4170230 commit 779ce29

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/pummel/test-keep-alive.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323

2424
// This test requires the program 'wrk'.
2525
const common = require('../common');
26-
if (common.isWindows)
27-
common.skip('no `wrk` on windows');
26+
27+
const child_process = require('child_process');
28+
const result = child_process.spawnSync('wrk', ['-h']);
29+
if (result.error && result.error.code === 'ENOENT')
30+
common.skip('test requires `wrk` to be installed first');
2831

2932
const assert = require('assert');
30-
const spawn = require('child_process').spawn;
3133
const http = require('http');
3234
const url = require('url');
3335

@@ -60,7 +62,7 @@ const runAb = (opts, callback) => {
6062
args.push(url.format({ hostname: '127.0.0.1',
6163
port: opts.port, protocol: 'http' }));
6264

63-
const child = spawn('wrk', args);
65+
const child = child_process.spawn('wrk', args);
6466
child.stderr.pipe(process.stderr);
6567
child.stdout.setEncoding('utf8');
6668

0 commit comments

Comments
 (0)