From 502f42c4b215562673fee5db8a8c078618748c5d Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 1 Feb 2020 23:07:53 +0100 Subject: [PATCH] test: fix flaky test-http2-stream-destroy-event-order Alternative to https://github.com/nodejs/node/pull/31590. It appears that the issue here is that the test falsely assumed that closing the client (which also currently destroys the socket rather than gracefully shutting down the connection) would still leave enough time for the server side to receive the stream error. Address that by explicitly waiting for the server side to receive the stream error before closing the client and the connection with it. Refs: https://github.com/nodejs/node/pull/31590 Refs: https://github.com/nodejs/node/issues/20750 PR-URL: https://github.com/nodejs/node/pull/31610 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Denys Otrishko Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- test/parallel/parallel.status | 3 --- test/parallel/test-http2-stream-destroy-event-order.js | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 15b547da1b15b5..76be70115dc458 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -22,9 +22,6 @@ test-http2-multistream-destroy-on-read-tls: PASS,FLAKY # https://github.com/nodejs/node/issues/20750 test-http2-pipe: PASS,FLAKY # https://github.com/nodejs/node/issues/20750 -# https://github.com/nodejs/node/pull/31590 -test-http2-stream-destroy-event-order: PASS,FLAKY -# https://github.com/nodejs/node/issues/20750 test-stream-pipeline-http2: PASS,FLAKY # https://github.com/nodejs/node/issues/24497 test-timers-immediate-queue: PASS,FLAKY diff --git a/test/parallel/test-http2-stream-destroy-event-order.js b/test/parallel/test-http2-stream-destroy-event-order.js index 88e4a99f99eee3..8fcbbabe3ce904 100644 --- a/test/parallel/test-http2-stream-destroy-event-order.js +++ b/test/parallel/test-http2-stream-destroy-event-order.js @@ -10,6 +10,7 @@ let req; const server = http2.createServer(); server.on('stream', common.mustCall((stream) => { stream.on('error', common.mustCall(() => { + client.close(); stream.on('close', common.mustCall(() => { server.close(); })); @@ -22,8 +23,6 @@ server.listen(0, common.mustCall(() => { req = client.request(); req.resume(); req.on('error', common.mustCall(() => { - req.on('close', common.mustCall(() => { - client.close(); - })); + req.on('close', common.mustCall()); })); }));