@@ -15,7 +15,6 @@ import {
1515describe ( "AuthorizationClient" , ( ) => {
1616 jest . setTimeout ( 60000 ) ;
1717
18- const clientPromise = orkesConductorClient ( ) ;
1918 const suffix = Date . now ( ) ;
2019
2120 let authClient : AuthorizationClient ;
@@ -31,8 +30,19 @@ describe("AuthorizationClient", () => {
3130 const groupsToCleanup : string [ ] = [ ] ;
3231
3332 beforeAll ( async ( ) => {
34- const client = await clientPromise ;
35- const clients = new OrkesClients ( client ) ;
33+ // Retry client creation to handle transient auth failures in CI
34+ const maxAttempts = 3 ;
35+ let client ;
36+ for ( let attempt = 1 ; attempt <= maxAttempts ; attempt ++ ) {
37+ try {
38+ client = await orkesConductorClient ( ) ;
39+ break ;
40+ } catch ( e ) {
41+ if ( attempt === maxAttempts ) throw e ;
42+ await new Promise ( ( r ) => setTimeout ( r , 2000 * attempt ) ) ;
43+ }
44+ }
45+ const clients = new OrkesClients ( client ! ) ;
3646 authClient = clients . getAuthorizationClient ( ) ;
3747 metadataClient = clients . getMetadataClient ( ) ;
3848
@@ -57,6 +67,8 @@ describe("AuthorizationClient", () => {
5767 } ) ;
5868
5969 afterAll ( async ( ) => {
70+ // Skip cleanup if beforeAll failed (e.g. auth error in CI) and clients were never set
71+ if ( ! authClient || ! metadataClient ) return ;
6072 // Cleanup groups first (they reference users)
6173 for ( const gid of groupsToCleanup ) {
6274 try {
0 commit comments