From 08f9411bb9cbf7a04cf53a2d2f9298ddcd660323 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 9 Aug 2023 11:15:56 +0200 Subject: [PATCH] Increase server close timeout Prior to Node.js 19.0.0, calling close while an idle client was connected to a server would not actually close the server before the client disconnected. This behavior was modified in Node.js 19.0.0: https://github.com/nodejs/node/pull/43522 This resulted in our mock server being closed before we expected and as a result, some of the tests in `cluster.test.js` would fail. This is because the 1 second timeout is lower than the exponential backoff logic in the `_autoRetry` function inside the `native_realm.js` file. To get around this issue, the timeout have simply been incresed to 5 seconds instead of 1. This is not pretty, but it gets the job done. --- packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js b/packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js index 5ef6145698811..0d44b8a775b25 100644 --- a/packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js +++ b/packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js @@ -87,11 +87,11 @@ const { ES_KEY_PATH, ES_CERT_PATH } = require('@kbn/dev-utils'); } ); - // setup server auto close after 1 second of silence + // setup server auto close after 5 second of silence let serverCloseTimer; const delayServerClose = () => { clearTimeout(serverCloseTimer); - serverCloseTimer = setTimeout(() => server.close(), 1000); + serverCloseTimer = setTimeout(() => server.close(), 5000); }; server.on('request', delayServerClose); server.on('listening', delayServerClose);