Skip to content

Commit eee8e62

Browse files
committed
set tmpnet exports for CLI interface
1 parent 10e5ccb commit eee8e62

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

tests/fixture/tmpnet/network.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func (n *Network) Create(rootDir string) error {
295295
n.Dir = canonicalDir
296296

297297
// Ensure the existence of the plugin directory or nodes won't be able to start.
298-
pluginDir, err := n.getPluginDir()
298+
pluginDir, err := n.GetPluginDir()
299299
if err != nil {
300300
return err
301301
}
@@ -480,7 +480,7 @@ func (n *Network) Bootstrap(ctx context.Context, log logging.Logger) error {
480480
func (n *Network) StartNode(ctx context.Context, log logging.Logger, node *Node) error {
481481
// This check is duplicative for a network that is starting, but ensures
482482
// that individual node start/restart won't fail due to missing binaries.
483-
pluginDir, err := n.getPluginDir()
483+
pluginDir, err := n.GetPluginDir()
484484
if err != nil {
485485
return err
486486
}
@@ -494,7 +494,7 @@ func (n *Network) StartNode(ctx context.Context, log logging.Logger, node *Node)
494494
return err
495495
}
496496

497-
bootstrapIPs, bootstrapIDs, err := n.getBootstrapIPsAndIDs(node)
497+
bootstrapIPs, bootstrapIDs, err := n.GetBootstrapIPsAndIDs(node)
498498
if err != nil {
499499
return err
500500
}
@@ -612,7 +612,7 @@ func (n *Network) EnsureNodeConfig(node *Node) error {
612612
}
613613

614614
if n.Genesis != nil {
615-
defaultFlags[config.GenesisFileKey] = n.getGenesisPath()
615+
defaultFlags[config.GenesisFileKey] = n.GetGenesisPath()
616616
}
617617

618618
// Only set the subnet dir if it exists or the node won't start.
@@ -843,7 +843,7 @@ func (n *Network) GetNodeURIs() []NodeURI {
843843

844844
// Retrieves bootstrap IPs and IDs for all nodes except the skipped one (this supports
845845
// collecting the bootstrap details for restarting a node).
846-
func (n *Network) getBootstrapIPsAndIDs(skippedNode *Node) ([]string, []string, error) {
846+
func (n *Network) GetBootstrapIPsAndIDs(skippedNode *Node) ([]string, []string, error) {
847847
// Collect staking addresses of non-ephemeral nodes for use in bootstrapping a node
848848
nodes, err := ReadNodes(n.Dir, false /* includeEphemeral */)
849849
if err != nil {
@@ -882,7 +882,7 @@ func (n *Network) GetNetworkID() uint32 {
882882
return n.NetworkID
883883
}
884884

885-
func (n *Network) getPluginDir() (string, error) {
885+
func (n *Network) GetPluginDir() (string, error) {
886886
return n.DefaultFlags.GetStringVal(config.PluginDirKey)
887887
}
888888

tests/fixture/tmpnet/network_config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ func (n *Network) writeNodes() error {
8181
return nil
8282
}
8383

84-
func (n *Network) getGenesisPath() string {
84+
func (n *Network) GetGenesisPath() string {
8585
return filepath.Join(n.Dir, "genesis.json")
8686
}
8787

8888
func (n *Network) readGenesis() error {
89-
bytes, err := os.ReadFile(n.getGenesisPath())
89+
bytes, err := os.ReadFile(n.GetGenesisPath())
9090
if err != nil {
9191
return fmt.Errorf("failed to read genesis: %w", err)
9292
}
@@ -103,7 +103,7 @@ func (n *Network) writeGenesis() error {
103103
if err != nil {
104104
return fmt.Errorf("failed to marshal genesis: %w", err)
105105
}
106-
if err := os.WriteFile(n.getGenesisPath(), bytes, perms.ReadWrite); err != nil {
106+
if err := os.WriteFile(n.GetGenesisPath(), bytes, perms.ReadWrite); err != nil {
107107
return fmt.Errorf("failed to write genesis: %w", err)
108108
}
109109
return nil

tests/fixture/tmpnet/node_config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import (
1717
// The Node type is defined in this file node_config.go
1818
// (reading/writing configuration) and node.go (orchestration).
1919

20-
func (n *Node) getFlagsPath() string {
20+
func (n *Node) GetFlagsPath() string {
2121
return filepath.Join(n.GetDataDir(), "flags.json")
2222
}
2323

2424
func (n *Node) readFlags() error {
25-
bytes, err := os.ReadFile(n.getFlagsPath())
25+
bytes, err := os.ReadFile(n.GetFlagsPath())
2626
if err != nil {
2727
return fmt.Errorf("failed to read node flags: %w", err)
2828
}
@@ -39,7 +39,7 @@ func (n *Node) writeFlags() error {
3939
if err != nil {
4040
return fmt.Errorf("failed to marshal node flags: %w", err)
4141
}
42-
if err := os.WriteFile(n.getFlagsPath(), bytes, perms.ReadWrite); err != nil {
42+
if err := os.WriteFile(n.GetFlagsPath(), bytes, perms.ReadWrite); err != nil {
4343
return fmt.Errorf("failed to write node flags: %w", err)
4444
}
4545
return nil

tests/fixture/tmpnet/node_process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (p *NodeProcess) Start(log logging.Logger) error {
9696
}
9797

9898
// All arguments are provided in the flags file
99-
cmd := exec.Command(p.node.RuntimeConfig.AvalancheGoPath, "--config-file", p.node.getFlagsPath()) // #nosec G204
99+
cmd := exec.Command(p.node.RuntimeConfig.AvalancheGoPath, "--config-file", p.node.GetFlagsPath()) // #nosec G204
100100
// Ensure process is detached from the parent process so that an error in the parent will not affect the child
101101
configureDetachedProcess(cmd)
102102

0 commit comments

Comments
 (0)