@@ -4,7 +4,6 @@ package node
44
55import (
66 "context"
7- "errors"
87 "testing"
98 "time"
109
@@ -22,16 +21,6 @@ func TestBasicExecutionFlow(t *testing.T) {
2221 node , cleanup := createNodeWithCleanup (t , getTestConfig (t , 1 ))
2322 defer cleanup ()
2423
25- ctx , cancel := context .WithCancel (t .Context ())
26- defer cancel ()
27- go func () {
28- _ = node .Run (ctx )
29- }()
30-
31- // Wait for node initialization
32- err := waitForNodeInitialization (node )
33- require .NoError (err )
34-
3524 // Get the original executor to retrieve transactions
3625 executor := getExecutorFromNode (t , node )
3726 require .NotNil (executor , "Executor should not be nil" )
@@ -64,27 +53,6 @@ func TestBasicExecutionFlow(t *testing.T) {
6453 finalizeExecution (t , mockExec , t .Context ())
6554
6655 require .NotEmpty (newStateRoot )
67- cancel ()
68- time .Sleep (100 * time .Millisecond ) // grace period for node shutdown and cleanup
69- }
70-
71- func waitForNodeInitialization (node * FullNode ) error {
72- ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
73- defer cancel ()
74-
75- ticker := time .NewTicker (100 * time .Millisecond )
76- defer ticker .Stop ()
77-
78- for {
79- select {
80- case <- ticker .C :
81- if node .IsRunning () {
82- return nil
83- }
84- case <- ctx .Done ():
85- return errors .New ("timeout waiting for node initialization" )
86- }
87- }
8856}
8957
9058func getExecutorFromNode (t * testing.T , node * FullNode ) coreexecutor.Executor {
0 commit comments