From 16e4a5cb18a77775e0b3b2dae47af0216d425f76 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 24 Sep 2018 06:11:12 -0700 Subject: [PATCH] test: improve debugging information for http2 test In test-http2-session-timeout, provide the number of requests that occurred when the test fails. PR-URL: https://github.com/nodejs/node/pull/23058 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau Reviewed-By: Trivikram Kamat Reviewed-By: Sakthipriyan Vairamani --- test/sequential/test-http2-session-timeout.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/sequential/test-http2-session-timeout.js b/test/sequential/test-http2-session-timeout.js index 9f0c8cd4d003c8..14a31bad9bd0fc 100644 --- a/test/sequential/test-http2-session-timeout.js +++ b/test/sequential/test-http2-session-timeout.js @@ -3,10 +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; @@ -32,6 +37,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);