From 779ce29f3987a0b79798f50618eeb15f8de52d84 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 15 Jan 2019 07:27:55 -0800 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/25516 Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- test/pummel/test-keep-alive.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index 5d2f00170d45b0..896f0a1f68d28f 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -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');