From 3d5ea002b823c8d13ba904d0d703b3ff67de31e3 Mon Sep 17 00:00:00 2001 From: KillianG Date: Fri, 4 Oct 2024 10:28:04 +0200 Subject: [PATCH] Add timeout for not found as during a replication pause it is normal not to find the object Issue: ZENKO-4903 --- tests/ctst/steps/utils/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/ctst/steps/utils/utils.ts b/tests/ctst/steps/utils/utils.ts index 88f01b4ce2..bd3b07ba4d 100644 --- a/tests/ctst/steps/utils/utils.ts +++ b/tests/ctst/steps/utils/utils.ts @@ -296,9 +296,15 @@ async function verifyObjectLocation(this: Zenko, objectName: string, this.addCommandParameter({ versionId }); } let conditionOk = false; + + const startTime = Date.now(); + while (!conditionOk) { const res = await S3.headObject(this.getCommandParameters()); if (res.err?.includes('NotFound')) { + if (Date.now() - startTime > 30000) { + throw new Error('Object not found after 30 seconds'); + } await Utils.sleep(1000); continue; } else if (res.err) {