diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index e9121bb99ef1..5e80573542b4 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -48,8 +48,8 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { ginkgo.By("initializing a coreth client") node := privateNetwork.Nodes[0] nodeURI := tmpnet.NodeURI{ - ID: node.ID, - URI: node.URI, + NodeID: node.NodeID, + URI: node.URI, } ethClient := e2e.NewEthClient(nodeURI) diff --git a/tests/e2e/faultinjection/duplicate_node_id.go b/tests/e2e/faultinjection/duplicate_node_id.go index 98e971f5bbf1..65a81a0a05eb 100644 --- a/tests/e2e/faultinjection/duplicate_node_id.go +++ b/tests/e2e/faultinjection/duplicate_node_id.go @@ -76,7 +76,7 @@ func checkConnectedPeers(existingNodes []*tmpnet.Node, newNode *tmpnet.Node) { for _, existingNode := range existingNodes { // Check that the existing node is a peer of the new node - require.True(peerIDs.Contains(existingNode.ID)) + require.True(peerIDs.Contains(existingNode.NodeID)) // Check that the new node is a peer infoClient := info.NewClient(existingNode.URI) @@ -84,7 +84,7 @@ func checkConnectedPeers(existingNodes []*tmpnet.Node, newNode *tmpnet.Node) { require.NoError(err) isPeer := false for _, peer := range peers { - if peer.ID == newNode.ID { + if peer.ID == newNode.NodeID { isPeer = true break } diff --git a/tests/fixture/e2e/env.go b/tests/fixture/e2e/env.go index 1d9e7f13eb98..c50a2a7aace2 100644 --- a/tests/fixture/e2e/env.go +++ b/tests/fixture/e2e/env.go @@ -91,7 +91,7 @@ func NewTestEnvironment(flagVars *FlagVars) *TestEnvironment { func (te *TestEnvironment) GetRandomNodeURI() tmpnet.NodeURI { r := rand.New(rand.NewSource(time.Now().Unix())) //#nosec G404 nodeURI := te.URIs[r.Intn(len(te.URIs))] - tests.Outf("{{blue}} targeting node %s with URI: %s{{/}}\n", nodeURI.ID, nodeURI.URI) + tests.Outf("{{blue}} targeting node %s with URI: %s{{/}}\n", nodeURI.NodeID, nodeURI.URI) return nodeURI } diff --git a/tests/fixture/e2e/helpers.go b/tests/fixture/e2e/helpers.go index ba2e2cbb982a..36555bae598c 100644 --- a/tests/fixture/e2e/helpers.go +++ b/tests/fixture/e2e/helpers.go @@ -62,7 +62,7 @@ const ( // Create a new wallet for the provided keychain against the specified node URI. func NewWallet(keychain *secp256k1fx.Keychain, nodeURI tmpnet.NodeURI) primary.Wallet { - tests.Outf("{{blue}} initializing a new wallet for node %s with URI: %s {{/}}\n", nodeURI.ID, nodeURI.URI) + tests.Outf("{{blue}} initializing a new wallet for node %s with URI: %s {{/}}\n", nodeURI.NodeID, nodeURI.URI) baseWallet, err := primary.MakeWallet(DefaultContext(), &primary.WalletConfig{ URI: nodeURI.URI, AVAXKeychain: keychain, @@ -81,7 +81,7 @@ func NewWallet(keychain *secp256k1fx.Keychain, nodeURI tmpnet.NodeURI) primary.W // Create a new eth client targeting the specified node URI. func NewEthClient(nodeURI tmpnet.NodeURI) ethclient.Client { - tests.Outf("{{blue}} initializing a new eth client for node %s with URI: %s {{/}}\n", nodeURI.ID, nodeURI.URI) + tests.Outf("{{blue}} initializing a new eth client for node %s with URI: %s {{/}}\n", nodeURI.NodeID, nodeURI.URI) nodeAddress := strings.Split(nodeURI.URI, "//")[1] uri := fmt.Sprintf("ws://%s/ext/bc/C/ws", nodeAddress) client, err := ethclient.Dial(uri) @@ -136,7 +136,7 @@ func AddEphemeralNode(network *tmpnet.Network, flags tmpnet.FlagsMap) *tmpnet.No // Ensure node is stopped on teardown. It's configuration is not removed to enable // collection in CI to aid in troubleshooting failures. ginkgo.DeferCleanup(func() { - tests.Outf("Shutting down ephemeral node %s\n", node.ID) + tests.Outf("Shutting down ephemeral node %s\n", node.NodeID) require.NoError(node.Stop()) }) @@ -213,7 +213,7 @@ func CheckBootstrapIsPossible(network *tmpnet.Network) { require.NoError(err) defer func() { - tests.Outf("Shutting down ephemeral node %s\n", node.ID) + tests.Outf("Shutting down ephemeral node %s\n", node.NodeID) require.NoError(node.Stop()) }() diff --git a/tests/fixture/tmpnet/config.go b/tests/fixture/tmpnet/config.go index e6c753709777..90a6c7bda04a 100644 --- a/tests/fixture/tmpnet/config.go +++ b/tests/fixture/tmpnet/config.go @@ -153,14 +153,14 @@ func (c *NetworkConfig) EnsureGenesis(networkID uint32, initialStakers []genesis // NodeURI associates a node ID with its API URI. type NodeURI struct { - ID ids.NodeID - URI string + NodeID ids.NodeID + URI string } // NodeConfig defines configuration for an AvalancheGo node. type NodeConfig struct { - ID ids.NodeID - Flags FlagsMap + NodeID ids.NodeID + Flags FlagsMap } func NewNodeConfig() *NodeConfig { @@ -306,7 +306,7 @@ func (nc *NodeConfig) EnsureNodeID() error { return fmt.Errorf("failed to ensure node ID: failed to load tls cert: %w", err) } stakingCert := staking.CertificateFromX509(tlsCert.Leaf) - nc.ID = ids.NodeIDFromCert(stakingCert) + nc.NodeID = ids.NodeIDFromCert(stakingCert) return nil } diff --git a/tests/fixture/tmpnet/network.go b/tests/fixture/tmpnet/network.go index fd84b638dce6..9c7eb976979d 100644 --- a/tests/fixture/tmpnet/network.go +++ b/tests/fixture/tmpnet/network.go @@ -302,7 +302,7 @@ func (n *Network) PopulateNodeConfig(node *Node, nodeParentDir string) error { dataDir := node.GetDataDir() if len(dataDir) == 0 { // NodeID will have been set by EnsureKeys - dataDir = filepath.Join(nodeParentDir, node.ID.String()) + dataDir = filepath.Join(nodeParentDir, node.NodeID.String()) flags[config.DataDirKey] = dataDir } @@ -352,7 +352,7 @@ func (n *Network) Start(w io.Writer) error { } // Collect bootstrap nodes for subsequently started nodes to use - bootstrapIDs = append(bootstrapIDs, node.ID.String()) + bootstrapIDs = append(bootstrapIDs, node.NodeID.String()) bootstrapIPs = append(bootstrapIPs, node.StakingAddress) } @@ -367,7 +367,7 @@ func (n *Network) WaitForHealthy(ctx context.Context, w io.Writer) error { healthyNodes := set.NewSet[ids.NodeID](len(n.Nodes)) for healthyNodes.Len() < len(n.Nodes) { for _, node := range n.Nodes { - if healthyNodes.Contains(node.ID) { + if healthyNodes.Contains(node.NodeID) { continue } @@ -379,8 +379,8 @@ func (n *Network) WaitForHealthy(ctx context.Context, w io.Writer) error { continue } - healthyNodes.Add(node.ID) - if _, err := fmt.Fprintf(w, "%s is healthy @ %s\n", node.ID, node.URI); err != nil { + healthyNodes.Add(node.NodeID) + if _, err := fmt.Fprintf(w, "%s is healthy @ %s\n", node.NodeID, node.URI); err != nil { return err } } @@ -404,8 +404,8 @@ func (n *Network) GetURIs() []NodeURI { // node.ReadProcessContext() was called. if len(node.URI) > 0 { uris = append(uris, NodeURI{ - ID: node.ID, - URI: node.URI, + NodeID: node.NodeID, + URI: node.URI, }) } } @@ -418,7 +418,7 @@ func (n *Network) Stop() error { // Assume the nodes are loaded and the pids are current for _, node := range n.Nodes { if err := node.Stop(); err != nil { - errs = append(errs, fmt.Errorf("failed to stop node %s: %w", node.ID, err)) + errs = append(errs, fmt.Errorf("failed to stop node %s: %w", node.NodeID, err)) } } if len(errs) > 0 { @@ -691,7 +691,7 @@ func (n *Network) GetBootstrapIPsAndIDs() ([]string, []string, error) { } bootstrapIPs = append(bootstrapIPs, node.StakingAddress) - bootstrapIDs = append(bootstrapIDs, node.ID.String()) + bootstrapIDs = append(bootstrapIDs, node.NodeID.String()) } if len(bootstrapIDs) == 0 { @@ -719,7 +719,7 @@ func stakersForNodes(networkID uint32, nodes []*Node) ([]genesis.UnparsedStaker, return nil, fmt.Errorf("failed to derive proof of possession: %w", err) } initialStakers[i] = genesis.UnparsedStaker{ - NodeID: node.ID, + NodeID: node.NodeID, RewardAddress: rewardAddr, DelegationFee: .01 * reward.PercentDenominator, Signer: pop, diff --git a/tests/fixture/tmpnet/node.go b/tests/fixture/tmpnet/node.go index be35aba5fafc..64ca8f11802f 100644 --- a/tests/fixture/tmpnet/node.go +++ b/tests/fixture/tmpnet/node.go @@ -165,12 +165,12 @@ func (n *Node) Start(w io.Writer, defaultExecPath string) error { } // Determine appropriate level of node description detail - nodeDescription := fmt.Sprintf("node %q", n.ID) + nodeDescription := fmt.Sprintf("node %q", n.NodeID) isEphemeralNode := filepath.Base(filepath.Dir(n.GetDataDir())) == defaultEphemeralDirName if isEphemeralNode { nodeDescription = "ephemeral " + nodeDescription } - nonDefaultNodeDir := filepath.Base(n.GetDataDir()) != n.ID.String() + nonDefaultNodeDir := filepath.Base(n.GetDataDir()) != n.NodeID.String() if nonDefaultNodeDir { // Only include the data dir if its base is not the default (the node ID) nodeDescription = fmt.Sprintf("%s with path: %s", nodeDescription, n.GetDataDir()) @@ -261,7 +261,7 @@ func (n *Node) Stop() error { select { case <-ctx.Done(): - return fmt.Errorf("failed to see node process stop %q before timeout: %w", n.ID, ctx.Err()) + return fmt.Errorf("failed to see node process stop %q before timeout: %w", n.NodeID, ctx.Err()) case <-ticker.C: } } @@ -310,12 +310,12 @@ func (n *Node) WaitForProcessContext(ctx context.Context) error { for len(n.URI) == 0 { err := n.ReadProcessContext() if err != nil { - return fmt.Errorf("failed to read process context for node %q: %w", n.ID, err) + return fmt.Errorf("failed to read process context for node %q: %w", n.NodeID, err) } select { case <-ctx.Done(): - return fmt.Errorf("failed to load process context for node %q before timeout: %w", n.ID, ctx.Err()) + return fmt.Errorf("failed to load process context for node %q before timeout: %w", n.NodeID, ctx.Err()) case <-ticker.C: } } diff --git a/tests/fixture/tmpnet/utils.go b/tests/fixture/tmpnet/utils.go index e8c950857c8d..b8508c3880e2 100644 --- a/tests/fixture/tmpnet/utils.go +++ b/tests/fixture/tmpnet/utils.go @@ -20,7 +20,7 @@ var ErrNotRunning = errors.New("not running") // WaitForHealthy blocks until Node.IsHealthy returns true or an error (including context timeout) is observed. func WaitForHealthy(ctx context.Context, node *Node) error { if _, ok := ctx.Deadline(); !ok { - return fmt.Errorf("unable to wait for health for node %q with a context without a deadline", node.ID) + return fmt.Errorf("unable to wait for health for node %q with a context without a deadline", node.NodeID) } ticker := time.NewTicker(DefaultNodeTickerInterval) defer ticker.Stop() @@ -28,7 +28,7 @@ func WaitForHealthy(ctx context.Context, node *Node) error { for { healthy, err := node.IsHealthy(ctx) if err != nil && !errors.Is(err, ErrNotRunning) { - return fmt.Errorf("failed to wait for health of node %q: %w", node.ID, err) + return fmt.Errorf("failed to wait for health of node %q: %w", node.NodeID, err) } if healthy { return nil @@ -36,7 +36,7 @@ func WaitForHealthy(ctx context.Context, node *Node) error { select { case <-ctx.Done(): - return fmt.Errorf("failed to wait for health of node %q before timeout: %w", node.ID, ctx.Err()) + return fmt.Errorf("failed to wait for health of node %q before timeout: %w", node.NodeID, ctx.Err()) case <-ticker.C: } } diff --git a/tests/upgrade/upgrade_test.go b/tests/upgrade/upgrade_test.go index 33364333abcf..0f65c0202385 100644 --- a/tests/upgrade/upgrade_test.go +++ b/tests/upgrade/upgrade_test.go @@ -52,7 +52,7 @@ var _ = ginkgo.Describe("[Upgrade]", func() { ginkgo.By(fmt.Sprintf("restarting all nodes with %q binary", avalancheGoExecPathToUpgradeTo)) for _, node := range network.Nodes { - ginkgo.By(fmt.Sprintf("restarting node %q with %q binary", node.ID, avalancheGoExecPathToUpgradeTo)) + ginkgo.By(fmt.Sprintf("restarting node %q with %q binary", node.NodeID, avalancheGoExecPathToUpgradeTo)) require.NoError(node.Stop()) // A node must start with sufficient bootstrap nodes to represent a quorum. Since the node's current @@ -72,7 +72,7 @@ var _ = ginkgo.Describe("[Upgrade]", func() { node.ExecPath = avalancheGoExecPathToUpgradeTo require.NoError(node.Start(ginkgo.GinkgoWriter, "" /* defaultExecPath */)) - ginkgo.By(fmt.Sprintf("waiting for node %q to report healthy after restart", node.ID)) + ginkgo.By(fmt.Sprintf("waiting for node %q to report healthy after restart", node.NodeID)) e2e.WaitForHealthy(node) }