Skip to content

Commit 5b8c62c

Browse files
santigimenoBridgeAR
authored andcommitted
test: fix flaky http-client-timeout-agent
Close the connection immediately after receiving the `end` event to avoid that the `timeout` event is fired before the connection closes gracefully. Move the test back to parallel. PR-URL: nodejs#19856 Fixes: nodejs#19804 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 8788046 commit 5b8c62c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/sequential/test-http-client-timeout-agent.js renamed to test/parallel/test-http-client-timeout-agent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,10 @@ const server = http.createServer(function(req, res) {
4646

4747
server.listen(0, options.host, function() {
4848
options.port = this.address().port;
49-
let req;
5049

5150
for (requests_sent = 0; requests_sent < 30; requests_sent += 1) {
5251
options.path = `/${requests_sent}`;
53-
req = http.request(options);
52+
const req = http.request(options);
5453
req.id = requests_sent;
5554
req.on('response', function(res) {
5655
res.on('data', function(data) {
@@ -59,6 +58,7 @@ server.listen(0, options.host, function() {
5958
res.on('end', function(data) {
6059
console.log(`res#${this.req.id} end`);
6160
requests_done += 1;
61+
req.destroy();
6262
});
6363
});
6464
req.on('close', function() {

0 commit comments

Comments
 (0)