Skip to content

Commit f9bbd35

Browse files
Trottcodebytere
authored andcommitted
test: make test-http2-client-jsstream-destroy.js reliable
Use events instead of setTimeout() calls. Fixes: #36078 PR-URL: #36129 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent c19df17 commit f9bbd35

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎test/parallel/test-http2-client-jsstream-destroy.js‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ server.listen(0, common.mustCall(function(){
4646
});
4747
constreq=client.request();
4848

49-
setTimeout(()=>socket.destroy(),common.platformTimeout(100));
50-
setTimeout(()=>client.close(),common.platformTimeout(200));
51-
setTimeout(()=>server.close(),common.platformTimeout(300));
49+
server.on('request',()=>{
50+
socket.destroy();
51+
});
5252

53-
req.on('close',common.mustCall(()=>{}));
53+
req.on('close',common.mustCall(()=>{
54+
client.close();
55+
server.close();
56+
}));
5457
});
5558
}));

0 commit comments

Comments
(0)