Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions test/issue-5087.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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

Expand Down
Loading