Skip to content

Commit d77f305

Browse files
committedFeb 8, 2016
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.
1 parent 6e3bccb commit d77f305

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed
 

‎test/parallel/test-http-1.0.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ function test(handler, request_generator, response_validator) {
1515
var client_got_eof = false;
1616
var server_response = '';
1717

18-
function cleanup() {
19-
server.close();
20-
response_validator(server_response, client_got_eof, true);
21-
}
22-
var timer = setTimeout(cleanup, common.platformTimeout(1000));
23-
process.on('exit', cleanup);
24-
2518
server.listen(port);
2619
server.on('listening', function() {
2720
var c = net.createConnection(port);
@@ -36,14 +29,12 @@ function test(handler, request_generator, response_validator) {
3629
server_response += chunk;
3730
});
3831

39-
c.on('end', function() {
32+
c.on('end', common.mustCall(function() {
4033
client_got_eof = true;
4134
c.end();
4235
server.close();
43-
clearTimeout(timer);
44-
process.removeListener('exit', cleanup);
4536
response_validator(server_response, client_got_eof, false);
46-
});
37+
}));
4738
});
4839
}
4940

0 commit comments

Comments
 (0)
Please sign in to comment.