diff --git a/test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs b/test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs index b5e16e8254f553..80c7be4931cd57 100644 --- a/test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs +++ b/test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs @@ -82,7 +82,19 @@ for (const testCase of testCases) { proxy.close(); server.close(); assert.deepStrictEqual(requests, expectedUrls); - assert.deepStrictEqual(new Set(logs), expectedProxyLogs); + const logSet = new Set(logs); + for (const log of logSet) { + if (log.source === 'proxy connect' && log.error?.code === 'EPIPE') { + // There can be a race from eagerly shutting down the servers and severing + // two pipes at the same time but for the purpose of this test, we only + // care about whether the requests are initiated from the client as expected, + // not how the upstream/proxy servers behave. Ignore EPIPE errors from them.. + // Refs: https://github.com/nodejs/node/issues/59741 + console.log('Ignoring EPIPE error from proxy connect', log.error); + logSet.delete(log); + } + } + assert.deepStrictEqual(logSet, expectedProxyLogs); })); } }));