Skip to content

Commit

Permalink
Add timeout for not found as during a replication pause it is normal …
Browse files Browse the repository at this point in the history
…not to find the object

Issue: ZENKO-4903
  • Loading branch information
KillianG committed Oct 4, 2024
1 parent a169989 commit c6c9649
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 2 additions & 4 deletions tests/ctst/steps/dr/drctl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,8 @@ type ReplicationResumeConfig = {
sourceKubeconfigData?: string;
sinkKubeconfigPath?: string;
sinkKubeconfigData?: string;
sourceZenkoInstance?: string;
sourceZenkoNamespace?: string;
sinkZenkoInstance?: string;
sinkZenkoNamespace?: string;
sourceZenkoDrNamespace?: string;
sinkZenkoDrNamespace?: string;
sourceZenkoDrInstance?: string;
sinkZenkoDrInstance?: string;
wait?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions tests/ctst/steps/pra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,10 @@ When('I resume the DR', { timeout: resumeTimeout + 2000 }, async function (this:
await this.zenkoDrCtl?.replicationResume({
sourceZenkoDrInstance: 'end2end-source',
sinkZenkoDrInstance: 'end2end-pra-sink',
sinkZenkoNamespace: 'default',
sourceZenkoNamespace: 'default',
sinkZenkoDrNamespace: 'default',
sourceZenkoDrNamespace: 'default',
wait: true,
timeout: `${resumeTimeout.toString()}ms`,
timeout: `${pauseTimeout.toString()}ms`,
});
});

Expand Down
6 changes: 6 additions & 0 deletions tests/ctst/steps/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 > 300000) {
throw new Error('Object not found after 300 seconds');
}
await Utils.sleep(1000);
continue;
} else if (res.err) {
Expand Down

0 comments on commit c6c9649

Please sign in to comment.