Skip to content

Commit

Permalink
feat: apply review
Browse files Browse the repository at this point in the history
Signed-off-by: Smuu <[email protected]>
  • Loading branch information
smuu committed Dec 9, 2024
1 parent 4bc3371 commit 34f8d11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
10 changes: 5 additions & 5 deletions test/e2e/testnet/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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:
// [email protected]: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 {
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/testnet/setup.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package testnet

import (
"context"
"fmt"
"strings"
"time"
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions test/e2e/testnet/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down Expand Up @@ -344,7 +344,7 @@ func (t *Testnet) RPCEndpoints() []string {
func (t *Testnet) RemoteGRPCEndpoints(ctx context.Context) ([]string, error) {

Check failure on line 344 in test/e2e/testnet/testnet.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
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
}
Expand All @@ -366,7 +366,7 @@ func (t *Testnet) GetGenesisValidators() []genesis.Validator {
func (t *Testnet) RemoteRPCEndpoints(ctx context.Context) ([]string, error) {

Check failure on line 366 in test/e2e/testnet/testnet.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
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
}
Expand Down Expand Up @@ -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...")
Expand Down

0 comments on commit 34f8d11

Please sign in to comment.