Skip to content

Commit

Permalink
test: make test-http2-client-jsstream-destroy.js reliable
Browse files Browse the repository at this point in the history
Use events instead of setTimeout() calls.

Fixes: #36078

PR-URL: #36129
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
Trott committed Nov 17, 2020
1 parent 0027aca commit fff25a0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/parallel/test-http2-client-jsstream-destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ server.listen(0, common.mustCall(function() {
});
const req = client.request();

setTimeout(() => socket.destroy(), common.platformTimeout(100));
setTimeout(() => client.close(), common.platformTimeout(200));
setTimeout(() => server.close(), common.platformTimeout(300));
server.on('request', () => {
socket.destroy();
});

req.on('close', common.mustCall(() => { }));
req.on('close', common.mustCall(() => {
client.close();
server.close();
}));
});
}));

0 comments on commit fff25a0

Please sign in to comment.