Skip to content

Commit a4a089a

Browse files
committed
test: deflake test-http-dump-req-when-res-ends.js
On some platforms the `'end'` event might not be emitted because the socket could be destroyed by the other peer while the client is still sending the data triggering an error. Use the `'close'` event instead. PR-URL: nodejs#30360 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 04e45db commit a4a089a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/parallel/parallel.status

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ test-worker-memory: PASS,FLAKY
1919
test-http2-client-upload: PASS,FLAKY
2020
# https://github.com/nodejs/node/issues/20750
2121
test-http2-client-upload-reject: PASS,FLAKY
22-
# https://github.com/nodejs/node/issues/30011
23-
test-http-dump-req-when-res-ends: PASS,FLAKY
2422

2523
[$system==linux]
2624

test/parallel/test-http-dump-req-when-res-ends.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ server.listen(0, mustCall(function() {
4848

4949
res.resume();
5050

51-
// Wait for the response.
52-
res.on('end', function() {
51+
// On some platforms the `'end'` event might not be emitted because the
52+
// socket could be destroyed by the other peer while data is still being
53+
// sent. In this case the 'aborted'` event is emitted instead of `'end'`.
54+
// `'close'` is used here because it is always emitted and does not
55+
// invalidate the test.
56+
res.on('close', function() {
5357
server.close();
5458
});
5559
}));

0 commit comments

Comments
 (0)