@@ -13,6 +13,7 @@ import {
1313 epochRotationOperations ,
1414 getConfigFromEnv ,
1515 installationCount ,
16+ maxConsecutiveFailures ,
1617 multinodeContainers ,
1718 NODE_VERSION ,
1819 otherOperations ,
@@ -149,7 +150,8 @@ describe(testName, () => {
149150 let currentEpoch = 0n ;
150151 let numConsecutiveFailures = 0 ;
151152
152- while ( currentEpoch < targetEpoch && numConsecutiveFailures < 5 ) {
153+ // Run until we reach the target epoch or we hit 5 consecutive failures.
154+ while ( currentEpoch < targetEpoch ) {
153155 const parallelOperationsArray = Array . from (
154156 { length : parallelOperations } ,
155157 ( ) =>
@@ -198,6 +200,8 @@ describe(testName, () => {
198200 }
199201 } ) ( ) ,
200202 ) ;
203+
204+ // We want to wait for all operations to complete, but ignore any errors which may be caused by the chaos
201205 const results = await Promise . allSettled ( parallelOperationsArray ) ;
202206 for ( const result of results ) {
203207 if ( result . status === "rejected" ) {
@@ -221,6 +225,9 @@ describe(testName, () => {
221225 } catch ( e ) {
222226 console . error ( `Group ${ groupIndex + 1 } operation failed:` , e ) ;
223227 numConsecutiveFailures ++ ;
228+ if ( numConsecutiveFailures >= maxConsecutiveFailures ) {
229+ throw e ;
230+ }
224231 }
225232 }
226233
@@ -232,6 +239,7 @@ describe(testName, () => {
232239 } catch ( e : any ) {
233240 const msg = `Error during fork testing: ${ e } ` ;
234241 console . error ( msg ) ;
242+ // This will fail the test if there were too many failures
235243 expect . fail ( msg ) ;
236244 } finally {
237245 clearInterval ( verifyInterval ) ;
0 commit comments