Skip to content

Commit

Permalink
test: fix flaky test-http2-stream-destroy-event-order
Browse files Browse the repository at this point in the history
Alternative to #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: #31590
Refs: #20750

PR-URL: #31610
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Denys Otrishko <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
addaleax authored and codebytere committed Mar 30, 2020
1 parent c892d41 commit 02c2396
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 0 additions & 3 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions test/parallel/test-http2-stream-destroy-event-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}));
Expand All @@ -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());
}));
}));

0 comments on commit 02c2396

Please sign in to comment.