mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
d979a9d391
commit
b49e63d51c
2 files changed
+6
-4
No files matched your search
@@ -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();
|
||||
});
|
||||
}));
|
||||
|
||||
Reference in new issue
Block a user