Skip to content

Commit 93ce076

Browse files
committed
test: deflake test-http-many-ended-pipelines
The socket might be destroyed by the other peer while data is still being written. Add the missing error handler. Fixes: nodejs#37291
1 parent 3ef9562 commit 93ce076

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/parallel/test-http-many-ended-pipelines.js

+9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ console.trace = function() {
2929
throw new Error('no tracing should happen here');
3030
};
3131

32+
const assert = require('assert');
3233
const http = require('http');
3334
const net = require('net');
3435

@@ -51,6 +52,14 @@ const server = http.createServer(function(req, res) {
5152
server.listen(0, function() {
5253
const client = net.connect({ port: this.address().port,
5354
allowHalfOpen: true });
55+
56+
client.on('error', function(err) {
57+
// The socket might be destroyed by the other peer while data is still
58+
// being written. The `'EPIPE'` and `'ECONNABORTED'` codes might also be
59+
// valid but they have not been seen yet.
60+
assert.strictEqual(err.code, 'ECONNRESET');
61+
});
62+
5463
for (let i = 0; i < numRequests; i++) {
5564
client.write('GET / HTTP/1.1\r\n' +
5665
'Host: some.host.name\r\n' +

0 commit comments

Comments
 (0)