From b5c0212d791edefcf1bd2ca9ebcca23d9d4494a7 Mon Sep 17 00:00:00 2001 From: CahidArda Date: Wed, 20 Nov 2024 12:28:47 +0300 Subject: [PATCH] ci: add retry to redis check --- examples/ci/app/ci/ci.test.ts | 2 +- examples/ci/app/ci/upstash/redis.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/ci/app/ci/ci.test.ts b/examples/ci/app/ci/ci.test.ts index 95a648c..e80b334 100644 --- a/examples/ci/app/ci/ci.test.ts +++ b/examples/ci/app/ci/ci.test.ts @@ -10,7 +10,7 @@ describe("workflow integration tests", () => { await initiateTest(testConfig.route, testConfig.waitForSeconds) }, { - timeout: (testConfig.waitForSeconds + 8) * 1000 + timeout: (testConfig.waitForSeconds + 10) * 1000 } ) }); diff --git a/examples/ci/app/ci/upstash/redis.ts b/examples/ci/app/ci/upstash/redis.ts index afa0b21..58acdf5 100644 --- a/examples/ci/app/ci/upstash/redis.ts +++ b/examples/ci/app/ci/upstash/redis.ts @@ -87,7 +87,16 @@ export const checkRedisForResults = async ( expectedResult: string, ) => { const key = getRedisKey("result", route, randomTestId) - const testResult = await redis.get(key) + let testResult: RedisResult | null = null + + for (let i=0; i<3; i++) { + testResult = await redis.get(key) + if (testResult) { + break + } + await new Promise(r => setTimeout(r, 2000)); + } + if (!testResult) { throw new Error(`result not found for route ${route} with randomTestId ${randomTestId}`) }