Skip to content

Commit

Permalink
test: add additional delay before deleting objects in rentention tests (
Browse files Browse the repository at this point in the history
#2279)

* test: add additional delay before deleting objects in rentention tests

* add additional step to remove retention policy

* simplify logic

* fix lint
  • Loading branch information
ddelgrosso1 committed Aug 18, 2023
1 parent e0f45c2 commit f340777
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions system-test/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1530,23 +1530,11 @@ describe('storage', () => {

async function createFile(): Promise<File> {
const file = BUCKET.file(generateName());
FILES.push(file);
await file.save('data');
FILES.push(file);
return file;
}

async function deleteFilesAsync() {
await new Promise(resolve =>
setTimeout(resolve, RETENTION_PERIOD_SECONDS * 1000)
);
return Promise.all(
FILES.map(async file => {
await file.setMetadata({temporaryHold: null});
return file.delete();
})
);
}

before(async () => {
await BUCKET.create({
retentionPolicy: {
Expand All @@ -1555,8 +1543,15 @@ describe('storage', () => {
});
});

after(() => {
return deleteFilesAsync();
after(async () => {
await new Promise(resolve =>
setTimeout(resolve, RETENTION_PERIOD_SECONDS * 1000)
);
await Promise.all(
FILES.map(async file => {
return file.delete();
})
);
});

it('should block an overwrite request', async () => {
Expand Down

0 comments on commit f340777

Please sign in to comment.