From 9ec0f8602429f95c84883dc510c84b6fdea4346f Mon Sep 17 00:00:00 2001 From: m5r Date: Wed, 10 Jul 2024 12:02:15 +0200 Subject: [PATCH] clean up trace --- test/e2e/cht-docker-utils.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/test/e2e/cht-docker-utils.js b/test/e2e/cht-docker-utils.js index c39d2af3..0ed98adb 100644 --- a/test/e2e/cht-docker-utils.js +++ b/test/e2e/cht-docker-utils.js @@ -66,18 +66,17 @@ const isProjectReady = async (projectName, attempt = 1) => { const url = await getProjectUrl(projectName); await request({ uri: `${url}/api/v2/monitoring`, json: true }) .catch(async (error) => { - log.error(error); - if (error.error.code === 'DEPTH_ZERO_SELF_SIGNED_CERT') { - await sleep(1000); - return isProjectReady(projectName, attempt + 1); + if ( + error.error.code !== 'DEPTH_ZERO_SELF_SIGNED_CERT' || + ![502, 503].includes(error.statusCode) + ) { + // unexpected error, log it to keep a trace, + // but we'll keep retrying until the instance is up, or we hit the timeout limit + log.trace(error); } - if ([502, 503].includes(error.statusCode)) { - await sleep(1000); - return isProjectReady(projectName, attempt + 1); - } - - throw error; + await sleep(1000); + return isProjectReady(projectName, attempt + 1); }); };