From 3cea8fcf0a21f04e14f32731e01f896068dff3db Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sat, 22 Feb 2020 22:01:06 +0100 Subject: [PATCH] test: fix flaky test-gc-net-timeout If the timeout is called in the time between 'end' and 'close' that would cause a EPIPE error. Essentially making the test flaky. PR-URL: https://github.com/nodejs/node/pull/31918 Reviewed-By: Anna Henningsen --- test/parallel/test-gc-net-timeout.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/parallel/test-gc-net-timeout.js b/test/parallel/test-gc-net-timeout.js index 51d9b8ca09bbbc..9ba6d2bc1744f9 100644 --- a/test/parallel/test-gc-net-timeout.js +++ b/test/parallel/test-gc-net-timeout.js @@ -12,6 +12,9 @@ function serverHandler(sock) { sock.on('close', function() { clearTimeout(timer); }); + sock.on('end', function() { + clearTimeout(timer); + }); sock.on('error', function(err) { assert.strictEqual(err.code, 'ECONNRESET'); });