Skip to content

Commit

Permalink
tests: add retry logic to ACL tests that rely on eventual consistency (
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelgrosso1 authored Jun 1, 2022
1 parent b5bb35c commit 1d7d075
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions system-test/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1015,19 +1015,35 @@ describe('storage', () => {
await file.save('data', {resumable: false});
});

it('should fail to get file ACL', () => {
return assert.rejects(
() => file.acl.get(),
validateUniformBucketLevelAccessEnabledError
);
});
it('should fail to get file ACL', async () => {
// Setting uniform bucket level access is eventually consistent and may take up to a minute to be reflected
for (;;) {
try {
await file.acl.get();
await new Promise(res => setTimeout(res, UNIFORM_ACCESS_WAIT_TIME));
} catch (err) {
assert(
validateUniformBucketLevelAccessEnabledError(err as ApiError)
);
break;
}
}
}).timeout(UNIFORM_ACCESS_TIMEOUT);

it('should fail to update file ACL', () => {
return assert.rejects(
() => file.acl.update(customAcl),
validateUniformBucketLevelAccessEnabledError
);
});
it('should fail to update file ACL', async () => {
// Setting uniform bucket level access is eventually consistent and may take up to a minute to be reflected
for (;;) {
try {
await file.acl.update(customAcl);
await new Promise(res => setTimeout(res, UNIFORM_ACCESS_WAIT_TIME));
} catch (err) {
assert(
validateUniformBucketLevelAccessEnabledError(err as ApiError)
);
break;
}
}
}).timeout(UNIFORM_ACCESS_TIMEOUT);
});

describe('preserves bucket/file ACL over uniform bucket-level access on/off', () => {
Expand Down

0 comments on commit 1d7d075

Please sign in to comment.