Skip to content

Commit

Permalink
clean up trace
Browse files Browse the repository at this point in the history
  • Loading branch information
m5r committed Jul 10, 2024
1 parent 9b1cfcc commit 9ec0f86
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions test/e2e/cht-docker-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};

Expand Down

0 comments on commit 9ec0f86

Please sign in to comment.