Skip to content
Permalink
Browse files

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: #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>
  • Loading branch information...
lpinca committed Nov 11, 2019
1 parent 04e45db commit a4a089a5687c99f42c37d4d80d73f79e4c8d8da8
Showing with 6 additions and 4 deletions.
  1. +0 −2 test/parallel/parallel.status
  2. +6 −2 test/parallel/test-http-dump-req-when-res-ends.js
@@ -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]

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

0 comments on commit a4a089a

Please sign in to comment.
You can’t perform that action at this time.