Skip to content

Commit

Permalink
test: deflake test-http-dump-req-when-res-ends.js
Browse files Browse the repository at this point in the history
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: #30360
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
lpinca authored and MylesBorins committed Dec 17, 2019
1 parent d979a9d commit b49e63d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 0 additions & 2 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ test-worker-memory: PASS,FLAKY
test-http2-client-upload: PASS,FLAKY
# https://github.com/nodejs/node/issues/20750
test-http2-client-upload-reject: PASS,FLAKY
# https://github.com/nodejs/node/issues/30011
test-http-dump-req-when-res-ends: PASS,FLAKY

[$system==linux]

Expand Down
8 changes: 6 additions & 2 deletions test/parallel/test-http-dump-req-when-res-ends.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ server.listen(0, mustCall(function() {

res.resume();

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

0 comments on commit b49e63d

Please sign in to comment.