8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5ee2bec commit 817b44dCopy full SHA for 817b44d
test/pummel/test-keep-alive.js
@@ -21,7 +21,7 @@
21
22
'use strict';
23
24
-// This test requires the program 'wrk'
+// This test requires the program 'wrk'.
25
const common = require('../common');
26
if (common.isWindows)
27
common.skip('no `wrk` on windows');
@@ -47,9 +47,9 @@ let normalReqSec = 0;
47
48
const runAb = (opts, callback) => {
49
const args = [
50
- '-c', opts.concurrent || 100,
+ '-c', opts.concurrent || 50,
51
'-t', opts.threads || 2,
52
- '-d', opts.duration || '10s',
+ '-d', opts.duration || '5s',
53
];
54
55
if (!opts.keepalive) {
@@ -58,7 +58,7 @@ const runAb = (opts, callback) => {
58
}
59
60
args.push(url.format({ hostname: '127.0.0.1',
61
- port: common.PORT, protocol: 'http' }));
+ port: opts.port, protocol: 'http' }));
62
63
const child = spawn('wrk', args);
64
child.stderr.pipe(process.stderr);
@@ -90,11 +90,12 @@ const runAb = (opts, callback) => {
90
});
91
};
92
93
-server.listen(common.PORT, () => {
94
- runAb({ keepalive: true }, (reqSec) => {
+server.listen(0, () => {
+ const port = server.address().port;
95
+ runAb({ keepalive: true, port: port }, (reqSec) => {
96
keepAliveReqSec = reqSec;
97
- runAb({ keepalive: false }, (reqSec) => {
98
+ runAb({ keepalive: false, port: port }, (reqSec) => {
99
normalReqSec = reqSec;
100
server.close();
101