Skip to content

Commit

Permalink
test: improve debugging information for http2 test
Browse files Browse the repository at this point in the history
In test-http2-session-timeout, provide the number of requests that
occurred when the test fails.

PR-URL: nodejs#23058
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
  • Loading branch information
Trott authored and kjin committed Oct 16, 2018
1 parent 593f8d9 commit 4f46d4b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/sequential/test-http2-session-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const http2 = require('http2');

const serverTimeout = common.platformTimeout(200);
const mustNotCall = common.mustNotCall();

let requests = 0;
const mustNotCall = () => {
assert.fail(`Timeout after ${requests} request(s)`);
};
const server = http2.createServer();
server.timeout = serverTimeout;

Expand All @@ -32,6 +36,8 @@ server.listen(0, common.mustCall(() => {
request.resume();
request.end();

requests += 1;

request.on('end', () => {
const diff = process.hrtime(startTime);
const milliseconds = (diff[0] * 1e3 + diff[1] / 1e6);
Expand Down

0 comments on commit 4f46d4b

Please sign in to comment.