diff options
author | Mithun Sasidharan <mithunsasidharan89@gmail.com> | 2017-11-22 15:39:07 +0530 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-11-28 02:43:20 +0100 |
commit | cd625e065838e744c988112498676f49b64e86b6 (patch) | |
tree | 2c7b2628d83d1297c632ad090715c508dd5bd5ae /test | |
parent | 7dc24062fc786f9a6bf92c16c832cc55d13df2b0 (diff) | |
download | android-node-v8-cd625e065838e744c988112498676f49b64e86b6.tar.gz android-node-v8-cd625e065838e744c988112498676f49b64e86b6.tar.bz2 android-node-v8-cd625e065838e744c988112498676f49b64e86b6.zip |
test: refactored http test to use countdown
PR-URL: https://github.com/nodejs/node/pull/17241
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-http-end-throw-socket-handling.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/parallel/test-http-end-throw-socket-handling.js b/test/parallel/test-http-end-throw-socket-handling.js index b6da0a96ea..956096270e 100644 --- a/test/parallel/test-http-end-throw-socket-handling.js +++ b/test/parallel/test-http-end-throw-socket-handling.js @@ -21,6 +21,7 @@ 'use strict'; const common = require('../common'); +const Countdown = require('../common/countdown'); // Make sure that throwing in 'end' handler doesn't lock // up the socket forever. @@ -29,10 +30,10 @@ const common = require('../common'); // the same, we should not be so brittle and easily broken. const http = require('http'); +const countdown = new Countdown(10, () => server.close()); -let n = 0; const server = http.createServer((req, res) => { - if (++n === 10) server.close(); + countdown.dec(); res.end('ok'); }); |