Skip to content

Commit

Permalink
Ensure data accessor is propagated in DR site
Browse files Browse the repository at this point in the history
As the data accessor is seeded by vault's cronjob, it might take
some time to be processed by kafka, so accessing it directly
won't work.

Issue: ZENKO-4871
  • Loading branch information
williamlardier committed Sep 6, 2024
1 parent a198cd1 commit 63cee3b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
37 changes: 24 additions & 13 deletions tests/ctst/steps/pra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,22 +275,33 @@ Then('object {string} should {string} be {string} and have the storage class {st
}
});

When('the DATA_ACCESSOR user tries to perform PutObject on {string} site', async function (this: Zenko, site: string) {
if (site === 'DR') {
Identity.useIdentity(IdentityEnum.ACCOUNT, `${Zenko.sites['source'].accountName}-replicated`);
} else {
Identity.useIdentity(IdentityEnum.ACCOUNT, Zenko.sites['source'].accountName);
}
this.resetCommand();
this.addToSaved('accountName', Zenko.sites['source'].accountName);
When('the DATA_ACCESSOR user tries to perform PutObject on {string} site', { timeout: 5 * 60 * 1000 },
async function (this: Zenko, site: string) {
if (site === 'DR') {
Identity.useIdentity(IdentityEnum.ACCOUNT, `${Zenko.sites['source'].accountName}-replicated`);
} else {
Identity.useIdentity(IdentityEnum.ACCOUNT, Zenko.sites['source'].accountName);
}
this.resetCommand();
this.addToSaved('accountName', Zenko.sites['source'].accountName);

await this.setupEntity(EntityType.DATA_ACCESSOR);
// At this point, the role may take some time to be propagated
// so, tolerate up to 5m of retries
let conditionOk = false;
while (!conditionOk) {
try {
await this.setupEntity(EntityType.DATA_ACCESSOR);
conditionOk = true;
} catch (err) {
this.logger.error('Failed to setup entity', { err });
}
}

this.addCommandParameter({ bucket: this.getSaved<string>('bucketName') });
this.addCommandParameter({ key: `${Utils.randomString()}` });
this.addCommandParameter({ bucket: this.getSaved<string>('bucketName') });
this.addCommandParameter({ key: `${Utils.randomString()}` });

this.setResult(await S3.putObject(this.getCommandParameters()));
});
this.setResult(await S3.putObject(this.getCommandParameters()));
});

Then('the kafka DR volume exists', { timeout: 60000 }, async function (this: Zenko) {
const volumeClaim = await getPVCFromLabel(this, 'kafka_cr', 'end2end-pra-sink-base-queue');
Expand Down
1 change: 1 addition & 0 deletions tests/ctst/world/Zenko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export default class Zenko extends World<ZenkoWorldParameters> {

nextMarker = GRFWIResponse.data.IsTruncated ? GRFWIResponse.data.Marker : undefined;
callNumber++;
await Utils.sleep(500);
} while (callNumber < 100);

// Ensure we can assume at least one role
Expand Down

0 comments on commit 63cee3b

Please sign in to comment.