From 34f8d11ec42ae569b8107265d1cd8720f9e8e692 Mon Sep 17 00:00:00 2001 From: Smuu <18609909+Smuu@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:14:32 +0100 Subject: [PATCH] feat: apply review Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com> --- test/e2e/testnet/node.go | 10 +++++----- test/e2e/testnet/setup.go | 3 +-- test/e2e/testnet/testnet.go | 11 +++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/test/e2e/testnet/node.go b/test/e2e/testnet/node.go index cb0ae30ca8..c186136e3e 100644 --- a/test/e2e/testnet/node.go +++ b/test/e2e/testnet/node.go @@ -218,7 +218,7 @@ func (n *Node) Init(ctx context.Context, genesis *types.GenesisDoc, peers []stri } // Create and write the config file - cfg, err := MakeConfig(ctx, n, peers, configOptions...) + cfg, err := MakeConfig(n, peers, configOptions...) if err != nil { return fmt.Errorf("making config: %w", err) } @@ -276,7 +276,7 @@ func (n *Node) Init(ctx context.Context, genesis *types.GenesisDoc, peers []stri // AddressP2P returns a P2P endpoint address for the node. This is used for // populating the address book. This will look something like: // 3314051954fc072a0678ec0cbac690ad8676ab98@61.108.66.220:26656 -func (n Node) AddressP2P(ctx context.Context, withID bool) string { +func (n Node) AddressP2P(withID bool) string { hostName := n.Instance.Network().HostName() addr := fmt.Sprintf("%v:%d", hostName, p2pPort) if withID { @@ -299,13 +299,13 @@ func (n Node) AddressRPC() string { // } // RemoteAddressGRPC retrieves the gRPC endpoint address of a node within the cluster. -func (n Node) RemoteAddressGRPC(ctx context.Context) (string, error) { +func (n Node) RemoteAddressGRPC() (string, error) { hostName := n.Instance.Network().HostName() return fmt.Sprintf("%s:%d", hostName, grpcPort), nil } // RemoteAddressRPC retrieves the RPC endpoint address of a node within the cluster. -func (n Node) RemoteAddressRPC(ctx context.Context) (string, error) { +func (n Node) RemoteAddressRPC() (string, error) { hostName := n.Instance.Network().HostName() return fmt.Sprintf("%s:%d", hostName, rpcPort), nil } @@ -314,7 +314,7 @@ func (n Node) AddressTracing() string { return n.traceProxyHost } -func (n Node) RemoteAddressTracing(ctx context.Context) (string, error) { +func (n Node) RemoteAddressTracing() (string, error) { hostName := n.Instance.Network().HostName() return fmt.Sprintf("http://%s:26661", hostName), nil } diff --git a/test/e2e/testnet/setup.go b/test/e2e/testnet/setup.go index 952b01b909..33b64973c6 100644 --- a/test/e2e/testnet/setup.go +++ b/test/e2e/testnet/setup.go @@ -1,7 +1,6 @@ package testnet import ( - "context" "fmt" "strings" "time" @@ -13,7 +12,7 @@ import ( "github.com/tendermint/tendermint/p2p/pex" ) -func MakeConfig(ctx context.Context, node *Node, peers []string, opts ...Option) (*config.Config, error) { +func MakeConfig(node *Node, peers []string, opts ...Option) (*config.Config, error) { cfg := app.DefaultConsensusConfig() cfg.TxIndex.Indexer = "kv" cfg.Consensus.TimeoutPropose = config.DefaultConsensusConfig().TimeoutPropose diff --git a/test/e2e/testnet/testnet.go b/test/e2e/testnet/testnet.go index 375f1a4e58..cada95988b 100644 --- a/test/e2e/testnet/testnet.go +++ b/test/e2e/testnet/testnet.go @@ -309,7 +309,7 @@ func (t *Testnet) Setup(ctx context.Context, configOpts ...Option) error { peers := make([]string, 0, len(t.nodes)-1) for _, peer := range t.nodes { if peer.Name != node.Name { - peers = append(peers, peer.AddressP2P(ctx, true)) + peers = append(peers, peer.AddressP2P(true)) } } @@ -344,7 +344,7 @@ func (t *Testnet) RPCEndpoints() []string { func (t *Testnet) RemoteGRPCEndpoints(ctx context.Context) ([]string, error) { grpcEndpoints := make([]string, len(t.nodes)) for idx, node := range t.nodes { - grpcEP, err := node.RemoteAddressGRPC(ctx) + grpcEP, err := node.RemoteAddressGRPC() if err != nil { return nil, err } @@ -366,7 +366,7 @@ func (t *Testnet) GetGenesisValidators() []genesis.Validator { func (t *Testnet) RemoteRPCEndpoints(ctx context.Context) ([]string, error) { rpcEndpoints := make([]string, len(t.nodes)) for idx, node := range t.nodes { - grpcEP, err := node.RemoteAddressRPC(ctx) + grpcEP, err := node.RemoteAddressRPC() if err != nil { return nil, err } @@ -399,10 +399,9 @@ func (t *Testnet) WaitToSync(ctx context.Context) error { log.Info().Int("attempts", i).Str("name", node.Name).Int64("latest_block_height", resp.SyncInfo.LatestBlockHeight).Msg( "node has synced") break - } else { - log.Info().Str("name", node.Name).Int("attempt", i).Msg( - "node status retrieved but not synced yet, waiting...") } + log.Info().Str("name", node.Name).Int("attempt", i).Msg( + "node status retrieved but not synced yet, waiting...") } else { log.Error().Str("name", node.Name).Int("attempt", i).Err(err).Msg( "error getting status, retrying...")