Skip to content

Commit c1ac4c8

Browse files
committed
fix(sanity): revert OAuth approach and expose bulk job auth errors
OAuth Changes: - Revert to separate login for OAuth tests (creates authtoken #2) - Maintains proper business logic separation between basic auth and OAuth flow - Total: 2 authtokens (both reused, no token limit issue) Bulk Operation Changes: - Expose 401/403 authentication errors immediately (don't retry) - Previously: silently caught ALL errors, hiding auth failures - Now: fail fast on auth errors, retry only on network/5xx errors - Increased polling: 5→10 attempts (50s max), 60s timeout - Result: tests will show real error instead of generic timeout This fixes the 401 errors visible in pipeline console that were being masked.
1 parent 63a0140 commit c1ac4c8

File tree

3 files changed

+160
-130
lines changed

3 files changed

+160
-130
lines changed

.talismanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fileignoreconfig:
7474
- filename: test/sanity-check/api/team-test.js
7575
checksum: e4b7a6824b89e634981651ad29161901377f23bb37d3653a389ac3dc4e7653c7
7676
- filename: test/sanity-check/api/oauth-test.js
77-
checksum: fd8a4fe7a644955ea6609813c655d8fca6bb3c7eeea4ae2c5ba99d30b1950172
77+
checksum: 7e2d6314f120c20a491d2f8403c9aa4e0af6dfc6fab436f0acc77953cef866e2
7878
- filename: test/sanity-check/api/branchAlias-test.js
7979
checksum: 0b6cacee74d7636e84ce095198f0234d491b79ea20d3978a742a5495692bd61d
8080
- filename: test/sanity-check/utility/testSetup.js

test/sanity-check/api/bulkOperation-test.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)