@@ -188,3 +188,43 @@ func GetGenesisHash(t *testing.T) string {
188188 require .NotEmpty (t , result .Result .Hash )
189189 return result .Result .Hash
190190}
191+
192+ // SetupTestRethEngineFullNode sets up a Reth full node test environment using Docker Compose with the full node configuration.
193+ // This function is specifically for setting up full nodes that connect to ports 8555/8561.
194+ func SetupTestRethEngineFullNode (t * testing.T , dockerPath , jwtFilename string ) string {
195+ t .Helper ()
196+ dockerAbsPath , err := filepath .Abs (dockerPath )
197+ require .NoError (t , err )
198+ jwtPath := filepath .Join (dockerAbsPath , "jwttoken" )
199+ err = os .MkdirAll (jwtPath , 0750 )
200+ require .NoError (t , err )
201+ jwtSecret , err := generateJWTSecret ()
202+ require .NoError (t , err )
203+ jwtFile := filepath .Join (jwtPath , jwtFilename )
204+ err = os .WriteFile (jwtFile , []byte (jwtSecret ), 0600 )
205+ require .NoError (t , err )
206+ t .Cleanup (func () { _ = os .Remove (jwtFile ) })
207+
208+ // Use the full node compose file
209+ composeFilePath := filepath .Join (dockerAbsPath , "docker-compose-full-node.yml" )
210+ identifier := tc .StackIdentifier (strings .ToLower (t .Name ()) + "_fullnode" )
211+ identifier = tc .StackIdentifier (strings .ReplaceAll (string (identifier ), "/" , "_" ))
212+ identifier = tc .StackIdentifier (strings .ReplaceAll (string (identifier ), " " , "_" ))
213+ compose , err := tc .NewDockerComposeWith (tc .WithStackFiles (composeFilePath ), identifier )
214+ require .NoError (t , err , "Failed to create docker compose for full node" )
215+ t .Cleanup (func () {
216+ ctx := context .Background ()
217+ err := compose .Down (ctx , tc .RemoveOrphans (true ), tc .RemoveVolumes (true ))
218+ if err != nil {
219+ t .Logf ("Warning: Failed to tear down docker-compose environment: %v" , err )
220+ }
221+ })
222+ ctx := context .Background ()
223+ err = compose .Up (ctx , tc .Wait (true ))
224+ require .NoError (t , err , "Failed to start docker compose for full node" )
225+
226+ // Wait for full node Reth container (ports 8555, 8561)
227+ err = waitForRethContainer (t , jwtSecret , "http://localhost:8555" , "http://localhost:8561" )
228+ require .NoError (t , err )
229+ return jwtSecret
230+ }
0 commit comments