@@ -84,16 +84,14 @@ func TestTxGossipingMultipleNodesDAIncluded(t *testing.T) {
8484
8585 numNodes := 4
8686 nodes , cleanups := createNodesWithCleanup (t , numNodes , config )
87- for _ , cleanup := range cleanups {
88- defer cleanup ()
89- }
9087
9188 ctxs , cancels := createNodeContexts (numNodes )
9289 var runningWg sync.WaitGroup
9390
9491 errChan := make (chan error , numNodes )
9592 // Start only the sequencer first
9693 startNodeInBackground (t , nodes , ctxs , & runningWg , 0 , errChan )
94+ t .Cleanup (func () { shutdownAndWait (t , cleanups , & runningWg , 10 * time .Second ) })
9795
9896 // Wait for the first block to be produced by the sequencer
9997 err := waitForFirstBlock (nodes [0 ], Header )
@@ -165,16 +163,13 @@ func TestFastDASync(t *testing.T) {
165163 config .DA .BlockTime = evconfig.DurationWrapper {Duration : 200 * time .Millisecond }
166164
167165 nodes , cleanups := createNodesWithCleanup (t , 2 , config )
168- for _ , cleanup := range cleanups {
169- defer cleanup ()
170- }
171-
172166 ctxs , cancels := createNodeContexts (len (nodes ))
173167 var runningWg sync.WaitGroup
174168
175169 errChan := make (chan error , len (nodes ))
176170 // Start only the first node
177171 startNodeInBackground (t , nodes , ctxs , & runningWg , 0 , errChan )
172+ t .Cleanup (func () { shutdownAndWait (t , cleanups , & runningWg , 10 * time .Second ) })
178173
179174 // Wait for the first node to produce a few blocks
180175 blocksToWaitFor := uint64 (2 )
@@ -185,6 +180,7 @@ func TestFastDASync(t *testing.T) {
185180
186181 // Now start the second node and time its sync
187182 startNodeInBackground (t , nodes , ctxs , & runningWg , 1 , errChan )
183+
188184 start := time .Now ()
189185 // Wait for the second node to catch up to the first node
190186 require .NoError (waitForAtLeastNBlocks (nodes [1 ], blocksToWaitFor , Store ))
@@ -327,6 +323,7 @@ func testSingleSequencerSingleFullNode(t *testing.T, source Source) {
327323
328324 // Start the sequencer first
329325 startNodeInBackground (t , nodes , ctxs , & runningWg , 0 , errChan )
326+ t .Cleanup (func () { shutdownAndWait (t , cancels , & runningWg , 10 * time .Second ) })
330327
331328 // Wait for the sequencer to produce at first block
332329 require .NoError (waitForFirstBlock (nodes [0 ], source ))
@@ -346,9 +343,6 @@ func testSingleSequencerSingleFullNode(t *testing.T, source Source) {
346343
347344 // Verify both nodes are synced using the helper
348345 require .NoError (verifyNodesSynced (nodes [0 ], nodes [1 ], source ))
349-
350- // Cancel all node contexts to signal shutdown and wait
351- shutdownAndWait (t , cancels , & runningWg , 5 * time .Second )
352346}
353347
354348// testSingleSequencerTwoFullNodes sets up a single sequencer and two full nodes, starts the sequencer, waits for it to produce a block, then starts the full nodes.
@@ -370,6 +364,7 @@ func testSingleSequencerTwoFullNodes(t *testing.T, source Source) {
370364
371365 // Start the sequencer first
372366 startNodeInBackground (t , nodes , ctxs , & runningWg , 0 , errChan )
367+ t .Cleanup (func () { shutdownAndWait (t , cancels , & runningWg , 10 * time .Second ) })
373368
374369 // Wait for the sequencer to produce at first block
375370 require .NoError (waitForFirstBlock (nodes [0 ], source ))
@@ -397,9 +392,6 @@ func testSingleSequencerTwoFullNodes(t *testing.T, source Source) {
397392 for i := 1 ; i < numNodes ; i ++ {
398393 require .NoError (verifyNodesSynced (nodes [0 ], nodes [i ], source ))
399394 }
400-
401- // Cancel all node contexts to signal shutdown and wait
402- shutdownAndWait (t , cancels , & runningWg , 5 * time .Second )
403395}
404396
405397// testSingleSequencerSingleFullNodeTrustedHash sets up a single sequencer and a single full node with a trusted hash, starts the sequencer, waits for it to produce a block, then starts the full node with the trusted hash.
@@ -421,6 +413,7 @@ func testSingleSequencerSingleFullNodeTrustedHash(t *testing.T, source Source) {
421413
422414 // Start the sequencer first
423415 startNodeInBackground (t , nodes , ctxs , & runningWg , 0 , errChan )
416+ t .Cleanup (func () { shutdownAndWait (t , cancels , & runningWg , 10 * time .Second ) })
424417
425418 // Wait for the sequencer to produce at first block
426419 require .NoError (waitForFirstBlock (nodes [0 ], source ))
@@ -461,9 +454,6 @@ func testSingleSequencerSingleFullNodeTrustedHash(t *testing.T, source Source) {
461454
462455 // Verify both nodes are synced using the helper
463456 require .NoError (verifyNodesSynced (nodes [0 ], nodes [1 ], source ))
464-
465- // Cancel all node contexts to signal shutdown and wait
466- shutdownAndWait (t , cancels , & runningWg , 5 * time .Second )
467457}
468458
469459// TestTwoChainsInOneNamespace verifies that two chains in the same namespace can coexist without any issues.
0 commit comments