test: ignore EPIPE errors in https proxy invalid URL test

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.

PR-URL: https://github.com/nodejs/node/pull/60269
Refs: https://github.com/nodejs/node/issues/59741
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
Joyee Cheung 2025-10-18 07:43:08 +02:00 committed by GitHub
parent 8656088090
commit c2d44174b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}));
}
}));