Skip to content

Commit caac389

Browse files
committed
test: skip ACL tests when uniform bucket-level access is enabled
1 parent 4785152 commit caac389

1 file changed

Lines changed: 78 additions & 13 deletions

File tree

handwritten/storage/system-test/storage.ts

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,22 @@ describe('storage', function () {
235235
);
236236
});
237237

238-
it('should get access controls', async () => {
238+
it('should get access controls', async function () {
239+
const [metadata] = await bucket.getMetadata();
240+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
241+
this.skip();
242+
}
243+
239244
const accessControls = await bucket.acl.get();
240245
assert(Array.isArray(accessControls));
241246
});
242247

243-
it('should add entity to default access controls', async () => {
248+
it('should add entity to default access controls', async function () {
249+
const [metadata] = await bucket.getMetadata();
250+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
251+
this.skip();
252+
}
253+
244254
const [accessControl] = await bucket.acl.default.add({
245255
entity: USER_ACCOUNT,
246256
role: storage.acl.OWNER_ROLE,
@@ -255,12 +265,22 @@ describe('storage', function () {
255265
await bucket.acl.default.delete({entity: USER_ACCOUNT});
256266
});
257267

258-
it('should get default access controls', async () => {
268+
it('should get default access controls', async function () {
269+
const [metadata] = await bucket.getMetadata();
270+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
271+
this.skip();
272+
}
273+
259274
const accessControls = await bucket.acl.default.get();
260275
assert(Array.isArray(accessControls));
261276
});
262277

263-
it('should grant an account access', async () => {
278+
it('should grant an account access', async function () {
279+
const [metadata] = await bucket.getMetadata();
280+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
281+
this.skip();
282+
}
283+
264284
const [accessControl] = await bucket.acl.add({
265285
entity: USER_ACCOUNT,
266286
role: storage.acl.OWNER_ROLE,
@@ -275,7 +295,12 @@ describe('storage', function () {
275295
await bucket.acl.delete(opts);
276296
});
277297

278-
it('should update an account', async () => {
298+
it('should update an account', async function () {
299+
const [metadata] = await bucket.getMetadata();
300+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
301+
this.skip();
302+
}
303+
279304
const [accessControl] = await bucket.acl.add({
280305
entity: USER_ACCOUNT,
281306
role: storage.acl.OWNER_ROLE,
@@ -350,7 +375,12 @@ describe('storage', function () {
350375
}
351376
});
352377

353-
it('should make files private', async () => {
378+
it('should make files private', async function () {
379+
const [metadata] = await bucket.getMetadata();
380+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
381+
this.skip();
382+
}
383+
354384
await Promise.all(
355385
['a', 'b', 'c'].map(text => createFileWithContentPromise(text)),
356386
);
@@ -381,7 +411,12 @@ describe('storage', function () {
381411
await file.delete();
382412
});
383413

384-
it('should get access controls', async () => {
414+
it('should get access controls', async function () {
415+
const [metadata] = await bucket.getMetadata();
416+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
417+
this.skip();
418+
}
419+
385420
const [accessControls] = await file.acl.get();
386421
assert(Array.isArray(accessControls));
387422
});
@@ -391,7 +426,12 @@ describe('storage', function () {
391426
assert.strictEqual(typeof (file as any).default, 'undefined');
392427
});
393428

394-
it('should grant an account access', async () => {
429+
it('should grant an account access', async function () {
430+
const [metadata] = await bucket.getMetadata();
431+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
432+
this.skip();
433+
}
434+
395435
const [accessControl] = await file.acl.add({
396436
entity: USER_ACCOUNT,
397437
role: storage.acl.OWNER_ROLE,
@@ -405,7 +445,12 @@ describe('storage', function () {
405445
await file.acl.delete({entity: USER_ACCOUNT});
406446
});
407447

408-
it('should update an account', async () => {
448+
it('should update an account', async function () {
449+
const [metadata] = await bucket.getMetadata();
450+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
451+
this.skip();
452+
}
453+
409454
const [accessControl] = await file.acl.add({
410455
entity: USER_ACCOUNT,
411456
role: storage.acl.OWNER_ROLE,
@@ -434,7 +479,12 @@ describe('storage', function () {
434479
await file.acl.delete({entity: 'allUsers'});
435480
});
436481

437-
it('should make a file private', async () => {
482+
it('should make a file private', async function () {
483+
const [metadata] = await bucket.getMetadata();
484+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
485+
this.skip();
486+
}
487+
438488
const validateMakeFilePrivateRejects = (err: ApiError) => {
439489
assert.strictEqual(err.code, 404);
440490
assert.strictEqual(err!.errors![0].reason, 'notFound');
@@ -507,7 +557,12 @@ describe('storage', function () {
507557
});
508558
});
509559

510-
it('should make a file private from a resumable upload', async () => {
560+
it('should make a file private from a resumable upload', async function () {
561+
const [metadata] = await bucket.getMetadata();
562+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
563+
this.skip();
564+
}
565+
511566
const validateMakeFilePrivateRejects = (err: ApiError) => {
512567
assert.strictEqual((err as ApiError)!.code, 404);
513568
assert.strictEqual((err as ApiError).errors![0].reason, 'notFound');
@@ -1159,7 +1214,12 @@ describe('storage', function () {
11591214
describe('preserves bucket/file ACL over uniform bucket-level access on/off', () => {
11601215
beforeEach(createBucket);
11611216

1162-
it('should preserve default bucket ACL', async () => {
1217+
it('should preserve default bucket ACL', async function () {
1218+
const [metadata] = await bucket.getMetadata();
1219+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
1220+
this.skip();
1221+
}
1222+
11631223
await bucket.acl.default.update(customAcl);
11641224
const [aclBefore] = await bucket.acl.default.get();
11651225

@@ -1178,7 +1238,12 @@ describe('storage', function () {
11781238
}
11791239
}).timeout(UNIFORM_ACCESS_TIMEOUT);
11801240

1181-
it('should preserve file ACL', async () => {
1241+
it('should preserve file ACL', async function () {
1242+
const [metadata] = await bucket.getMetadata();
1243+
if (metadata.iamConfiguration?.uniformBucketLevelAccess?.enabled) {
1244+
this.skip();
1245+
}
1246+
11821247
const file = bucket.file(`file-${crypto.randomUUID()}`);
11831248
await file.save('data', {resumable: false});
11841249

0 commit comments

Comments
 (0)