@@ -40,7 +40,7 @@ function assetsWithValidUids () {
4040 return [ assetUid1 , assetUid2 ] . filter ( uid => uid && String ( uid ) . trim ( ) ) . map ( uid => ( { uid } ) )
4141}
4242
43- async function waitForJobReady ( jobId , maxAttempts = 5 ) {
43+ async function waitForJobReady ( jobId , maxAttempts = 10 ) {
4444 for ( let attempt = 1 ; attempt <= maxAttempts ; attempt ++ ) {
4545 try {
4646 const response = await doBulkOperation ( )
@@ -49,7 +49,11 @@ async function waitForJobReady (jobId, maxAttempts = 5) {
4949 return response
5050 }
5151 } catch ( error ) {
52- // retry
52+ // Don't retry on auth errors (401/403) - fail immediately
53+ if ( error . status === 401 || error . status === 403 ) {
54+ throw new Error ( `Job status check failed with ${ error . status } : ${ error . errorMessage || error . message } ` )
55+ }
56+ // For other errors (network, 5xx), retry
5357 }
5458 await delay ( 5000 )
5559 }
@@ -360,7 +364,7 @@ describe('BulkOperation api test', () => {
360364 } )
361365
362366 it ( 'should wait for jobs to be ready and get job status for the first publish job' , async function ( ) {
363- this . timeout ( 30000 )
367+ this . timeout ( 60000 )
364368
365369 const response = await waitForJobReady ( jobId1 )
366370 expect ( response ) . to . not . equal ( undefined )
@@ -384,7 +388,7 @@ describe('BulkOperation api test', () => {
384388 } )
385389
386390 it ( 'should get job status for the second publish job' , async function ( ) {
387- this . timeout ( 30000 )
391+ this . timeout ( 60000 )
388392
389393 const response = await waitForJobReady ( jobId2 )
390394 expect ( response ) . to . not . equal ( undefined )
@@ -396,7 +400,7 @@ describe('BulkOperation api test', () => {
396400 } )
397401
398402 it ( 'should get job status for the third publish job' , async function ( ) {
399- this . timeout ( 30000 )
403+ this . timeout ( 60000 )
400404
401405 const response = await waitForJobReady ( jobId3 )
402406 expect ( response ) . to . not . equal ( undefined )
@@ -408,7 +412,7 @@ describe('BulkOperation api test', () => {
408412 } )
409413
410414 it ( 'should get job status for publishAllLocalized=true job' , async function ( ) {
411- this . timeout ( 30000 )
415+ this . timeout ( 60000 )
412416
413417 const response = await waitForJobReady ( jobId4 )
414418 expect ( response ) . to . not . equal ( undefined )
@@ -420,7 +424,7 @@ describe('BulkOperation api test', () => {
420424 } )
421425
422426 it ( 'should get job status for publishAllLocalized=false job' , async function ( ) {
423- this . timeout ( 30000 )
427+ this . timeout ( 60000 )
424428
425429 const response = await waitForJobReady ( jobId5 )
426430 expect ( response ) . to . not . equal ( undefined )
@@ -432,7 +436,7 @@ describe('BulkOperation api test', () => {
432436 } )
433437
434438 it ( 'should get job status for asset publishAllLocalized job' , async function ( ) {
435- this . timeout ( 30000 )
439+ this . timeout ( 60000 )
436440
437441 const response = await waitForJobReady ( jobId6 )
438442 expect ( response ) . to . not . equal ( undefined )
@@ -444,7 +448,7 @@ describe('BulkOperation api test', () => {
444448 } )
445449
446450 it ( 'should get job status for unpublishAllLocalized=true job' , async function ( ) {
447- this . timeout ( 30000 )
451+ this . timeout ( 60000 )
448452
449453 const response = await waitForJobReady ( jobId7 )
450454 expect ( response ) . to . not . equal ( undefined )
@@ -456,7 +460,7 @@ describe('BulkOperation api test', () => {
456460 } )
457461
458462 it ( 'should get job status for unpublishAllLocalized=false job' , async function ( ) {
459- this . timeout ( 30000 )
463+ this . timeout ( 60000 )
460464
461465 const response = await waitForJobReady ( jobId8 )
462466 expect ( response ) . to . not . equal ( undefined )
@@ -468,7 +472,7 @@ describe('BulkOperation api test', () => {
468472 } )
469473
470474 it ( 'should get job status for asset unpublishAllLocalized job' , async function ( ) {
471- this . timeout ( 30000 )
475+ this . timeout ( 60000 )
472476
473477 const response = await waitForJobReady ( jobId9 )
474478 expect ( response ) . to . not . equal ( undefined )
@@ -480,7 +484,7 @@ describe('BulkOperation api test', () => {
480484 } )
481485
482486 it ( 'should get job status for multiple parameters job' , async function ( ) {
483- this . timeout ( 30000 )
487+ this . timeout ( 60000 )
484488
485489 const response = await waitForJobReady ( jobId10 )
486490 expect ( response ) . to . not . equal ( undefined )
@@ -492,7 +496,7 @@ describe('BulkOperation api test', () => {
492496 } )
493497
494498 it ( 'should get job status with bulk_version parameter' , async function ( ) {
495- this . timeout ( 30000 )
499+ this . timeout ( 60000 )
496500
497501 await waitForJobReady ( jobId1 )
498502 const response = await doBulkOperationWithManagementToken ( tokenUidDev )
@@ -506,7 +510,7 @@ describe('BulkOperation api test', () => {
506510 } )
507511
508512 it ( 'should get job items for a completed job' , async function ( ) {
509- this . timeout ( 30000 )
513+ this . timeout ( 60000 )
510514
511515 await waitForJobReady ( jobId1 )
512516 const response = await doBulkOperationWithManagementToken ( tokenUidDev )
@@ -516,7 +520,7 @@ describe('BulkOperation api test', () => {
516520 } )
517521
518522 it ( 'should get job items with explicit api_version' , async function ( ) {
519- this . timeout ( 30000 )
523+ this . timeout ( 60000 )
520524
521525 await waitForJobReady ( jobId2 )
522526 const response = await doBulkOperationWithManagementToken ( tokenUidDev )
0 commit comments