Skip to content

Commit 3a0cb8f

Browse files
mithunsasidharangibfahn
authored andcommitted
test: refactored http test to use countdown
PR-URL: #17241 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent f3c1158 commit 3a0cb8f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎test/parallel/test-http-end-throw-socket-handling.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
constcommon=require('../common');
3+
constCountdown=require('../common/countdown');
34

45
// Make sure that throwing in 'end' handler doesn't lock
56
// up the socket forever.
@@ -8,10 +9,10 @@ const common = require('../common');
89
// the same, we should not be so brittle and easily broken.
910

1011
consthttp=require('http');
12+
constcountdown=newCountdown(10,()=>server.close());
1113

12-
letn=0;
1314
constserver=http.createServer((req,res)=>{
14-
if(++n===10)server.close();
15+
countdown.dec();
1516
res.end('ok');
1617
});
1718

0 commit comments

Comments
(0)