diff options
author | Santiago Gimeno <santiago.gimeno@gmail.com> | 2016-02-07 10:20:50 +0100 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-03-21 17:08:36 -0700 |
commit | 6a3d38f00f116cbe51cd006ee558ca773522e6f5 (patch) | |
tree | 98ea1979171134c07396328fd7e181dc2b7695d7 /test/parallel/test-http-1.0.js | |
parent | c7b127025a5e2fd9dc0ee9af22e091475d97e468 (diff) | |
download | android-node-v8-6a3d38f00f116cbe51cd006ee558ca773522e6f5.tar.gz android-node-v8-6a3d38f00f116cbe51cd006ee558ca773522e6f5.tar.bz2 android-node-v8-6a3d38f00f116cbe51cd006ee558ca773522e6f5.zip |
test: remove timer from test-http-1.0
It's possible that the `end` event is emitted after the timeout fires
causing the test to fail. Just remove the timer. If for some reason the
`end` would never fire, the test will fail with a timeout.
PR-URL: https://github.com/nodejs/node/pull/5129
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-http-1.0.js')
-rw-r--r-- | test/parallel/test-http-1.0.js | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/test/parallel/test-http-1.0.js b/test/parallel/test-http-1.0.js index f9c865f3e6..b4cb62534c 100644 --- a/test/parallel/test-http-1.0.js +++ b/test/parallel/test-http-1.0.js @@ -15,13 +15,6 @@ function test(handler, request_generator, response_validator) { var client_got_eof = false; var server_response = ''; - function cleanup() { - server.close(); - response_validator(server_response, client_got_eof, true); - } - var timer = setTimeout(cleanup, common.platformTimeout(1000)); - process.on('exit', cleanup); - server.listen(port); server.on('listening', function() { var c = net.createConnection(port); @@ -36,14 +29,12 @@ function test(handler, request_generator, response_validator) { server_response += chunk; }); - c.on('end', function() { + c.on('end', common.mustCall(function() { client_got_eof = true; c.end(); server.close(); - clearTimeout(timer); - process.removeListener('exit', cleanup); response_validator(server_response, client_got_eof, false); - }); + })); }); } |