From 2ecd0d51629adb489febc3d841a2e3aa943c5896 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. --- 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'); });