Skip to content

Commit

Permalink
Fix issue with client port.
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisPH3 committed Nov 28, 2024
1 parent 9ba5c30 commit 25ed064
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/integration_test_net.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ import (
// integration test networks can also be used for automated integration and
// regression tests for client code.
type IntegrationTestNet struct {
directory string
done <-chan struct{}
validator Account
clientPort int
directory string
done <-chan struct{}
validator Account
httpClientPort int
}

func isPortFree(host string, port int) bool {
Expand Down Expand Up @@ -218,7 +218,8 @@ func (n *IntegrationTestNet) start() error {
}

// find free ports for the http-client, ws-client, and network interfaces
httpPort, err := getFreePort()
var err error
n.httpClientPort, err = getFreePort()
if err != nil {
return err
}
Expand Down Expand Up @@ -250,7 +251,7 @@ func (n *IntegrationTestNet) start() error {
"--fakenet", "1/1",

// http-client option
"--http", "--http.addr", "127.0.0.1", "--http.port", fmt.Sprint(httpPort),
"--http", "--http.addr", "127.0.0.1", "--http.port", fmt.Sprint(n.httpClientPort),
"--http.api", "admin,eth,web3,net,txpool,ftm,trace,debug",

// websocket-client options
Expand Down Expand Up @@ -458,7 +459,7 @@ func (n *IntegrationTestNet) GetTransactOptions(account *Account) (*bind.Transac
// GetClient provides raw access to a fresh connection to the network.
// The resulting client must be closed after use.
func (n *IntegrationTestNet) GetClient() (*ethclient.Client, error) {
return ethclient.Dial(fmt.Sprintf("http://localhost:%d", n.clientPort))
return ethclient.Dial(fmt.Sprintf("http://localhost:%d", n.httpClientPort))
}

// RestartWithExportImport stops the network, exports the genesis file, cleans the
Expand Down

0 comments on commit 25ed064

Please sign in to comment.