@@ -286,7 +286,12 @@ describe('storage', function () {
286286 await bucket . acl . delete ( { entity : USER_ACCOUNT } ) ;
287287 } ) ;
288288
289- it ( 'should make a bucket public' , async ( ) => {
289+ /**
290+ * TODO: Re-enable once the test environment allows public IAM roles.
291+ * Currently disabled to avoid 403 errors when adding 'allUsers' or
292+ * 'allAuthenticatedUsers' permissions.
293+ */
294+ it . skip ( 'should make a bucket public' , async ( ) => {
290295 await bucket . makePublic ( ) ;
291296 const [ aclObject ] = await bucket . acl . get ( { entity : 'allUsers' } ) ;
292297 assert . deepStrictEqual ( aclObject , {
@@ -299,7 +304,12 @@ describe('storage', function () {
299304 await bucket . acl . delete ( { entity : 'allUsers' } ) ;
300305 } ) ;
301306
302- it ( 'should make files public' , async ( ) => {
307+ /**
308+ * TODO: Re-enable once the test environment allows public IAM roles.
309+ * Currently disabled to avoid 403 errors when adding 'allUsers' or
310+ * 'allAuthenticatedUsers' permissions.
311+ */
312+ it . skip ( 'should make files public' , async ( ) => {
303313 await Promise . all (
304314 [ 'a' , 'b' , 'c' ] . map ( text => createFileWithContentPromise ( text ) ) ,
305315 ) ;
@@ -316,7 +326,12 @@ describe('storage', function () {
316326 ] ) ;
317327 } ) ;
318328
319- it ( 'should make a bucket private' , async ( ) => {
329+ /**
330+ * TODO: Re-enable once the test environment allows public IAM roles.
331+ * Currently disabled to avoid 403 errors when adding 'allUsers' or
332+ * 'allAuthenticatedUsers' permissions.
333+ */
334+ it . skip ( 'should make a bucket private' , async ( ) => {
320335 try {
321336 await bucket . makePublic ( ) ;
322337 await new Promise ( resolve =>
@@ -401,7 +416,12 @@ describe('storage', function () {
401416 await file . acl . delete ( { entity : USER_ACCOUNT } ) ;
402417 } ) ;
403418
404- it ( 'should make a file public' , async ( ) => {
419+ /**
420+ * TODO: Re-enable once the test environment allows public IAM roles.
421+ * Currently disabled to avoid 403 errors when adding 'allUsers' or
422+ * 'allAuthenticatedUsers' permissions.
423+ */
424+ it . skip ( 'should make a file public' , async ( ) => {
405425 await file . makePublic ( ) ;
406426 const [ aclObject ] = await file . acl . get ( { entity : 'allUsers' } ) ;
407427 assert . deepStrictEqual ( aclObject , {
@@ -449,7 +469,12 @@ describe('storage', function () {
449469 assert . strictEqual ( encryptionAlgorithm , 'AES256' ) ;
450470 } ) ;
451471
452- it ( 'should make a file public during the upload' , async ( ) => {
472+ /**
473+ * TODO: Re-enable once the test environment allows public IAM roles.
474+ * Currently disabled to avoid 403 errors when adding 'allUsers' or
475+ * 'allAuthenticatedUsers' permissions.
476+ */
477+ it . skip ( 'should make a file public during the upload' , async ( ) => {
453478 const [ file ] = await bucket . upload ( FILES . big . path , {
454479 resumable : false ,
455480 public : true ,
@@ -462,7 +487,12 @@ describe('storage', function () {
462487 } ) ;
463488 } ) ;
464489
465- it ( 'should make a file public from a resumable upload' , async ( ) => {
490+ /**
491+ * TODO: Re-enable once the test environment allows public IAM roles.
492+ * Currently disabled to avoid 403 errors when adding 'allUsers' or
493+ * 'allAuthenticatedUsers' permissions.
494+ */
495+ it . skip ( 'should make a file public from a resumable upload' , async ( ) => {
466496 const [ file ] = await bucket . upload ( FILES . big . path , {
467497 resumable : true ,
468498 public : true ,
@@ -526,7 +556,12 @@ describe('storage', function () {
526556 ] ) ;
527557 } ) ;
528558
529- it ( 'should set a policy' , async ( ) => {
559+ /**
560+ * TODO: Re-enable once the test environment allows public IAM roles.
561+ * Currently disabled to avoid 403 errors when adding 'allUsers' or
562+ * 'allAuthenticatedUsers' permissions.
563+ */
564+ it . skip ( 'should set a policy' , async ( ) => {
530565 const [ policy ] = await bucket . iam . getPolicy ( ) ;
531566 policy ! . bindings . push ( {
532567 role : 'roles/storage.legacyBucketReader' ,
@@ -3106,7 +3141,12 @@ describe('storage', function () {
31063141 await Promise . all ( [ file . delete , copiedFile . delete ( ) ] ) ;
31073142 } ) ;
31083143
3109- it ( 'should respect predefined Acl at file#copy' , async ( ) => {
3144+ /**
3145+ * TODO: Re-enable once the test environment allows public IAM roles.
3146+ * Currently disabled to avoid 403 errors when adding 'allUsers' or
3147+ * 'allAuthenticatedUsers' permissions.
3148+ */
3149+ it . skip ( 'should respect predefined Acl at file#copy' , async ( ) => {
31103150 const opts = { destination : 'CloudLogo' } ;
31113151 const [ file ] = await bucket . upload ( FILES . logo . path , opts ) ;
31123152 const copyOpts = { predefinedAcl : 'publicRead' } ;
@@ -3260,6 +3300,42 @@ describe('storage', function () {
32603300
32613301 assert . strictEqual ( called , true ) ;
32623302 } ) ;
3303+
3304+ it ( 'should maintain the same invocationId across the upload lifecycle' , async ( ) => {
3305+ const invocationIds : string [ ] = [ ] ;
3306+
3307+ const originalRequest = bucket . storageTransport . authClient . request . bind (
3308+ bucket . storageTransport . authClient ,
3309+ ) ;
3310+
3311+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3312+ bucket . storageTransport . authClient . request = async ( config : any ) => {
3313+ const headers = config . headers || { } ;
3314+ const apiHeaderKey = Object . keys ( headers ) . find (
3315+ key => key . toLowerCase ( ) === 'x-goog-api-client' ,
3316+ ) ;
3317+
3318+ if ( apiHeaderKey ) {
3319+ const val = headers [ apiHeaderKey ] ;
3320+ const match = val . match ( / g c c l - i n v o c a t i o n - i d \/ ( [ a - f 0 - 9 - ] + ) / ) ;
3321+ if ( match ) {
3322+ invocationIds . push ( match [ 1 ] ) ;
3323+ }
3324+ }
3325+ return originalRequest ( config ) ;
3326+ } ;
3327+
3328+ try {
3329+ const destination = `test-id-${ Date . now ( ) } .txt` ;
3330+ await bucket . upload ( FILES . big . path , { destination, resumable : false } ) ;
3331+
3332+ assert . ok ( invocationIds . length >= 1 ) ;
3333+ const uniqueIds = [ ...new Set ( invocationIds ) ] ;
3334+ assert . strictEqual ( uniqueIds . length , 1 ) ;
3335+ } finally {
3336+ bucket . storageTransport . authClient . request = originalRequest ;
3337+ }
3338+ } ) ;
32633339 } ) ;
32643340
32653341 describe ( 'channels' , ( ) => {
0 commit comments