@@ -14,22 +14,19 @@ describe("RunEngine batchTriggerAndWait", () => {
1414 containerTest (
1515 "batchTriggerAndWait (no idempotency)" ,
1616 { timeout : 15_000 } ,
17- async ( { prisma, redisContainer } ) => {
17+ async ( { prisma, redisOptions } ) => {
1818 //create environment
1919 const authenticatedEnvironment = await setupAuthenticatedEnvironment ( prisma , "PRODUCTION" ) ;
2020
2121 const engine = new RunEngine ( {
2222 prisma,
2323 redis : {
24- host : redisContainer . getHost ( ) ,
25- port : redisContainer . getPort ( ) ,
26- password : redisContainer . getPassword ( ) ,
27- enableAutoPipelining : true ,
24+ ...redisOptions ,
2825 } ,
2926 worker : {
3027 workers : 1 ,
3128 tasksPerWorker : 10 ,
32- pollIntervalMs : 100 ,
29+ pollIntervalMs : 20 ,
3330 } ,
3431 machines : {
3532 defaultMachine : "small-1x" ,
@@ -207,14 +204,17 @@ describe("RunEngine batchTriggerAndWait", () => {
207204 masterQueue : child1 . masterQueue ,
208205 maxRunCount : 1 ,
209206 } ) ;
207+
208+ expect ( dequeuedChild . length ) . toBe ( 1 ) ;
209+
210210 const childAttempt1 = await engine . startRunAttempt ( {
211- runId : child1 . id ,
211+ runId : dequeuedChild [ 0 ] . run . id ,
212212 snapshotId : dequeuedChild [ 0 ] . snapshot . id ,
213213 } ) ;
214214
215215 // complete the 1st child
216216 await engine . completeRunAttempt ( {
217- runId : child1 . id ,
217+ runId : childAttempt1 . run . id ,
218218 snapshotId : childAttempt1 . snapshot . id ,
219219 completion : {
220220 id : child1 . id ,
@@ -225,7 +225,9 @@ describe("RunEngine batchTriggerAndWait", () => {
225225 } ) ;
226226
227227 //child snapshot
228- const childExecutionDataAfter = await engine . getRunExecutionData ( { runId : child1 . id } ) ;
228+ const childExecutionDataAfter = await engine . getRunExecutionData ( {
229+ runId : childAttempt1 . run . id ,
230+ } ) ;
229231 assertNonNullable ( childExecutionDataAfter ) ;
230232 expect ( childExecutionDataAfter . snapshot . executionStatus ) . toBe ( "FINISHED" ) ;
231233
@@ -261,12 +263,17 @@ describe("RunEngine batchTriggerAndWait", () => {
261263 expect ( parentExecutionDataAfterFirstChildComplete . batch ?. id ) . toBe ( batch . id ) ;
262264 expect ( parentExecutionDataAfterFirstChildComplete . completedWaitpoints . length ) . toBe ( 0 ) ;
263265
266+ expect ( await engine . runQueue . lengthOfEnvQueue ( authenticatedEnvironment ) ) . toBe ( 1 ) ;
267+
264268 //dequeue and start the 2nd child
265269 const dequeuedChild2 = await engine . dequeueFromMasterQueue ( {
266270 consumerId : "test_12345" ,
267271 masterQueue : child2 . masterQueue ,
268272 maxRunCount : 1 ,
269273 } ) ;
274+
275+ expect ( dequeuedChild2 . length ) . toBe ( 1 ) ;
276+
270277 const childAttempt2 = await engine . startRunAttempt ( {
271278 runId : child2 . id ,
272279 snapshotId : dequeuedChild2 [ 0 ] . snapshot . id ,
0 commit comments