diff --git a/test/e2e/pkg/infra/digitalocean/digitalocean.go b/test/e2e/pkg/infra/digitalocean/digitalocean.go index 14a148a41..f5bd0d2e8 100644 --- a/test/e2e/pkg/infra/digitalocean/digitalocean.go +++ b/test/e2e/pkg/infra/digitalocean/digitalocean.go @@ -34,11 +34,11 @@ func (p Provider) CreateNode(ctx context.Context, n *e2e.Node) error { return nil } func (p Provider) StartTendermint(ctx context.Context, n *e2e.Node) error { - return e2essh.Exec(p.SSHConfig, fmt.Sprintf("%s:%d", n.IP, sshPort), fmt.Sprintf("systemctl start %s", testappName)) + return e2essh.Exec(p.SSHConfig, fmt.Sprintf("%s:%d", n.InternalIP, sshPort), fmt.Sprintf("systemctl start %s", testappName)) } func (p Provider) TerminateTendermint(ctx context.Context, n *e2e.Node) error { - return e2essh.Exec(p.SSHConfig, fmt.Sprintf("%s:%d", n.IP, sshPort), fmt.Sprintf("systemctl -s SIGTERM %s", testappName)) + return e2essh.Exec(p.SSHConfig, fmt.Sprintf("%s:%d", n.InternalIP, sshPort), fmt.Sprintf("systemctl -s SIGTERM %s", testappName)) } func (p Provider) KillTendermint(ctx context.Context, n *e2e.Node) error { - return e2essh.Exec(p.SSHConfig, fmt.Sprintf("%s:%d", n.IP, sshPort), fmt.Sprintf("systemctl -s SIGKILL %s", testappName)) + return e2essh.Exec(p.SSHConfig, fmt.Sprintf("%s:%d", n.InternalIP, sshPort), fmt.Sprintf("systemctl -s SIGKILL %s", testappName)) } diff --git a/test/e2e/pkg/ssh/ssh.go b/test/e2e/pkg/ssh/ssh.go index 14ca37738..d129e9c80 100644 --- a/test/e2e/pkg/ssh/ssh.go +++ b/test/e2e/pkg/ssh/ssh.go @@ -7,6 +7,7 @@ import ( "net" "os" "path/filepath" + "time" "golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh/agent" @@ -14,10 +15,13 @@ import ( ) func Exec(cfg *ssh.ClientConfig, addr, cmd string) error { + start := time.Now() c, err := ssh.Dial("tcp", addr, cfg) if err != nil { return err } + after := time.Since(start) + fmt.Printf("Time: %s\n", after) defer c.Close() s, err := c.NewSession() if err != nil { diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index e5c58d3c8..c09dc6e90 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -84,7 +84,7 @@ type Node struct { SyncApp bool // Should we use a synchronized app with an unsynchronized local client? PrivvalKey crypto.PrivKey NodeKey crypto.PrivKey - IP net.IP + InternalIP net.IP ProxyPort uint32 StartAt int64 BlockSync string @@ -173,7 +173,7 @@ func LoadTestnet(manifest Manifest, fname string, ifd InfrastructureData) (*Test Testnet: testnet, PrivvalKey: keyGen.Generate(manifest.KeyType), NodeKey: keyGen.Generate("ed25519"), - IP: ind.IPAddress, + InternalIP: ind.IPAddress, ProxyPort: ind.Port, Mode: ModeValidator, SyncApp: nodeManifest.SyncApp, @@ -308,18 +308,18 @@ func (n Node) Validate(testnet Testnet) error { if n.Name == "" { return errors.New("node has no name") } - if n.IP == nil { + if n.InternalIP == nil { return errors.New("node has no IP address") } - if !testnet.IP.Contains(n.IP) { - return fmt.Errorf("node IP %v is not in testnet network %v", n.IP, testnet.IP) + if !testnet.IP.Contains(n.InternalIP) { + return fmt.Errorf("node IP %v is not in testnet network %v", n.InternalIP, testnet.IP) } if n.ProxyPort > 0 { if n.ProxyPort <= 1024 { return fmt.Errorf("local port %v must be >1024", n.ProxyPort) } for _, peer := range testnet.Nodes { - if peer.Name != n.Name && peer.ProxyPort == n.ProxyPort && peer.IP.Equal(n.IP) { + if peer.Name != n.Name && peer.ProxyPort == n.ProxyPort && peer.InternalIP.Equal(n.InternalIP) { return fmt.Errorf("peer %q also has local port %v", peer.Name, n.ProxyPort) } } @@ -435,8 +435,8 @@ func (t Testnet) HasPerturbations() bool { // Address returns a P2P endpoint address for the node. func (n Node) AddressP2P(withID bool) string { - ip := n.IP.String() - if n.IP.To4() == nil { + ip := n.InternalIP.String() + if n.InternalIP.To4() == nil { // IPv6 addresses must be wrapped in [] to avoid conflict with : port separator ip = fmt.Sprintf("[%v]", ip) } @@ -449,8 +449,8 @@ func (n Node) AddressP2P(withID bool) string { // Address returns an RPC endpoint address for the node. func (n Node) AddressRPC() string { - ip := n.IP.String() - if n.IP.To4() == nil { + ip := n.InternalIP.String() + if n.InternalIP.To4() == nil { // IPv6 addresses must be wrapped in [] to avoid conflict with : port separator ip = fmt.Sprintf("[%v]", ip) } @@ -459,7 +459,7 @@ func (n Node) AddressRPC() string { // Client returns an RPC client for a node. func (n Node) Client() (*rpchttp.HTTP, error) { - return rpchttp.New(fmt.Sprintf("http://%s:%v", n.IP, n.ProxyPort), "/websocket") + return rpchttp.New(fmt.Sprintf("http://%s:%v", n.InternalIP, n.ProxyPort), "/websocket") } // Stateless returns true if the node is either a seed node or a light node diff --git a/test/e2e/runner/start.go b/test/e2e/runner/start.go index 72ee3db6d..5353334ea 100644 --- a/test/e2e/runner/start.go +++ b/test/e2e/runner/start.go @@ -56,7 +56,7 @@ func Start(testnet *e2e.Testnet, p infra.Provider) error { if _, err := waitForNode(node, 0, 15*time.Second); err != nil { return err } - logger.Info("start", "msg", log.NewLazySprintf("Node %v up on http://%s:%v", node.Name, node.IP, node.ProxyPort)) + logger.Info("start", "msg", log.NewLazySprintf("Node %v up on http://%s:%v", node.Name, node.InternalIP, node.ProxyPort)) } networkHeight := testnet.InitialHeight @@ -117,7 +117,7 @@ func Start(testnet *e2e.Testnet, p infra.Provider) error { return err } logger.Info("start", "msg", log.NewLazySprintf("Node %v up on http://%s:%v at height %v", - node.Name, node.IP, node.ProxyPort, status.SyncInfo.LatestBlockHeight)) + node.Name, node.InternalIP, node.ProxyPort, status.SyncInfo.LatestBlockHeight)) } return nil diff --git a/test/e2e/tests/net_test.go b/test/e2e/tests/net_test.go index 1ca43fa05..00f50d3f3 100644 --- a/test/e2e/tests/net_test.go +++ b/test/e2e/tests/net_test.go @@ -34,7 +34,7 @@ func TestNet_Peers(t *testing.T) { for _, peerInfo := range netInfo.Peers { peer := node.Testnet.LookupNode(peerInfo.NodeInfo.Moniker) require.NotNil(t, peer, "unknown node %v", peerInfo.NodeInfo.Moniker) - require.Equal(t, peer.IP.String(), peerInfo.RemoteIP, + require.Equal(t, peer.InternalIP.String(), peerInfo.RemoteIP, "unexpected IP address for peer %v", peer.Name) seen[peerInfo.NodeInfo.Moniker] = true }