Skip to content

Commit

Permalink
test: add check for wrk to test-keep-alive
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Trott authored and addaleax committed Jan 23, 2019
1 parent 4170230 commit 779ce29
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/pummel/test-keep-alive.js
Original file line number Diff line number Diff line change
@@ -23,11 +23,13 @@

// This test requires the program 'wrk'.
const common = require('../common');
if (common.isWindows)
common.skip('no `wrk` on windows');

const child_process = require('child_process');
const result = child_process.spawnSync('wrk', ['-h']);
if (result.error && result.error.code === 'ENOENT')
common.skip('test requires `wrk` to be installed first');

const assert = require('assert');
const spawn = require('child_process').spawn;
const http = require('http');
const url = require('url');

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

const child = spawn('wrk', args);
const child = child_process.spawn('wrk', args);
child.stderr.pipe(process.stderr);
child.stdout.setEncoding('utf8');

0 comments on commit 779ce29

Please sign in to comment.