From 1e79a06ac6389e7b1e5d69fdd8f1754da13d2815 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 2 Oct 2017 15:16:10 -0700 Subject: [PATCH] test: fix flaky async-hooks/test-tlswrap There is a race condition in async-hooks/test-tlswrap. This addresses it by waiting 5 more ticks if the client has not been destroyed yet. PR-URL: https://github.com/nodejs/node/pull/15744 Fixes: https://github.com/nodejs/node/issues/14404 Reviewed-By: Refael Ackermann --- test/async-hooks/test-tlswrap.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/async-hooks/test-tlswrap.js b/test/async-hooks/test-tlswrap.js index 7d92b603f3e18a..79cf1ab689e997 100644 --- a/test/async-hooks/test-tlswrap.js +++ b/test/async-hooks/test-tlswrap.js @@ -91,6 +91,10 @@ function onsecureConnect() { // TODO: why is client not destroyed here even after 5 ticks? // or could it be that it isn't actually destroyed until // the server is closed? + if (client.before.length < 3) { + tick(5, tick1); + return; + } checkInvocations(client, { init: 1, before: 3, after: 3 }, 'client: when client destroyed'); //