From c1232d89df6966fd700461617db20f70b059b5f2 Mon Sep 17 00:00:00 2001 From: Luan Taraschi <130802253+luantaraschi@users.noreply.github.com> Date: Mon, 17 Aug 2026 09:14:28 -0300 Subject: [PATCH] test(h2): swallow late session errors in the issue-5087 timeout tests All three tests abort a request client-side once the timeout fires, so the server session and its socket can surface a late ECONNRESET after the test body resolved. The runner reports that as a file-level failure with no failing assertion, which is what has been happening on CI. Same swallow pattern #5674 and #5686 applied to the neighbouring h2 tests, with connection standing in for the TLS-only secureConnection hook, because these servers are h2c. --- test/issue-5087.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/test/issue-5087.js b/test/issue-5087.js index 36cf6059f70..c1751a9e1da 100644 --- a/test/issue-5087.js +++ b/test/issue-5087.js @@ -11,6 +11,19 @@ test('https://github.com/nodejs/undici/issues/5087 bodyTimeout over h2 rejects w t = tspl(t, { plan: 3 }) const server = createServer() + + // A timed-out request is aborted client-side, so the server session and its + // socket can surface a late ECONNRESET after the test body has resolved. The + // runner turns that into a file-level failure with no failing assertion. + // Same swallow pattern as test/http2-abort.js, minus the TLS-only + // 'secureConnection' hook: these servers are h2c. + server.on('error', () => {}) + server.on('connection', (socket) => socket.on('error', () => {})) + server.on('session', (session) => { + session.on('error', () => {}) + session.socket?.on('error', () => {}) + }) + server.on('stream', (stream) => { stream.respond({ ':status': 200, 'content-type': 'text/plain' }) setTimeout(() => { @@ -51,6 +64,19 @@ test('https://github.com/nodejs/undici/issues/5087 headersTimeout over h2 reject t = tspl(t, { plan: 3 }) const server = createServer() + + // A timed-out request is aborted client-side, so the server session and its + // socket can surface a late ECONNRESET after the test body has resolved. The + // runner turns that into a file-level failure with no failing assertion. + // Same swallow pattern as test/http2-abort.js, minus the TLS-only + // 'secureConnection' hook: these servers are h2c. + server.on('error', () => {}) + server.on('connection', (socket) => socket.on('error', () => {})) + server.on('session', (session) => { + session.on('error', () => {}) + session.socket?.on('error', () => {}) + }) + server.on('stream', (stream) => { setTimeout(() => { try { @@ -89,6 +115,19 @@ test('https://github.com/nodejs/undici/issues/5087 RetryAgent retries h2 body ti let hits = 0 const server = createServer() + + // A timed-out request is aborted client-side, so the server session and its + // socket can surface a late ECONNRESET after the test body has resolved. The + // runner turns that into a file-level failure with no failing assertion. + // Same swallow pattern as test/http2-abort.js, minus the TLS-only + // 'secureConnection' hook: these servers are h2c. + server.on('error', () => {}) + server.on('connection', (socket) => socket.on('error', () => {})) + server.on('session', (session) => { + session.on('error', () => {}) + session.socket?.on('error', () => {}) + }) + server.on('stream', (stream) => { hits += 1