Skip to content

Commit 24d08fe

Browse files
mithunsasidharanMylesBorins
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 46c1d99 commit 24d08fe

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
'use strict';
2323
const common = require('../common');
24+
const Countdown = require('../common/countdown');
2425

2526
// Make sure that throwing in 'end' handler doesn't lock
2627
// up the socket forever.
@@ -29,10 +30,10 @@ const common = require('../common');
2930
// the same, we should not be so brittle and easily broken.
3031

3132
const http = require('http');
33+
const countdown = new Countdown(10, () => server.close());
3234

33-
let n = 0;
3435
const server = http.createServer((req, res) => {
35-
if (++n === 10) server.close();
36+
countdown.dec();
3637
res.end('ok');
3738
});
3839

0 commit comments

Comments
 (0)