Skip to content

Commit 2e56bcd

Browse files
committed
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.
1 parent db0121b commit 2e56bcd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,19 @@ for (const testCase of testCases) {
8282
proxy.close();
8383
server.close();
8484
assert.deepStrictEqual(requests, expectedUrls);
85-
assert.deepStrictEqual(new Set(logs), expectedProxyLogs);
85+
const logSet = new Set(logs);
86+
for (const log of logSet) {
87+
if (log.source === 'proxy connect' && log.error?.code === 'EPIPE') {
88+
// There can be a race from eagerly shutting down the servers and severing
89+
// two pipes at the same time but for the purpose of this test, we only
90+
// care about whether the requests are initiated from the client as expected,
91+
// not how the upstream/proxy servers behave. Ignore EPIPE errors from them..
92+
// Refs: https://github.com/nodejs/node/issues/59741
93+
console.log('Ignoring EPIPE error from proxy connect', log.error);
94+
logSet.delete(log);
95+
}
96+
}
97+
assert.deepStrictEqual(logSet, expectedProxyLogs);
8698
});
8799
}
88100
}));

0 commit comments

Comments
 (0)