@@ -59,16 +59,6 @@ type NodeRuntimeConfig struct {
59
59
60
60
// Node supports configuring and running a node participating in a temporary network.
61
61
type Node struct {
62
- // Uniquely identifies the network the node is part of to enable monitoring.
63
- NetworkUUID string
64
-
65
- // Identify the entity associated with this network. This is
66
- // intended to be used to label metrics to enable filtering
67
- // results for a test run between the primary/shared network used
68
- // by the majority of tests and private networks used by
69
- // individual tests.
70
- NetworkOwner string
71
-
72
62
// Set by EnsureNodeID which is also called when the node is read.
73
63
NodeID ids.NodeID
74
64
@@ -89,6 +79,9 @@ type Node struct {
89
79
90
80
// Initialized on demand
91
81
runtime NodeRuntime
82
+
83
+ // Intended to be set by the network
84
+ network * Network
92
85
}
93
86
94
87
// Initializes a new node with only the data dir set
@@ -129,11 +122,11 @@ func ReadNode(dataDir string) (*Node, error) {
129
122
}
130
123
131
124
// Reads nodes from the specified network directory.
132
- func ReadNodes (networkDir string , includeEphemeral bool ) ([]* Node , error ) {
125
+ func ReadNodes (network * Network , includeEphemeral bool ) ([]* Node , error ) {
133
126
nodes := []* Node {}
134
127
135
128
// Node configuration is stored in child directories
136
- entries , err := os .ReadDir (networkDir )
129
+ entries , err := os .ReadDir (network . Dir )
137
130
if err != nil {
138
131
return nil , fmt .Errorf ("failed to read dir: %w" , err )
139
132
}
@@ -142,7 +135,7 @@ func ReadNodes(networkDir string, includeEphemeral bool) ([]*Node, error) {
142
135
continue
143
136
}
144
137
145
- nodeDir := filepath .Join (networkDir , entry .Name ())
138
+ nodeDir := filepath .Join (network . Dir , entry .Name ())
146
139
node , err := ReadNode (nodeDir )
147
140
if errors .Is (err , os .ErrNotExist ) {
148
141
// If no config file exists, assume this is not the path of a node
@@ -159,6 +152,8 @@ func ReadNodes(networkDir string, includeEphemeral bool) ([]*Node, error) {
159
152
return nil , fmt .Errorf ("failed to ensure NodeID: %w" , err )
160
153
}
161
154
155
+ node .network = network
156
+
162
157
nodes = append (nodes , node )
163
158
}
164
159
@@ -382,7 +377,7 @@ func (n *Node) GetUniqueID() string {
382
377
nodeIDString := n .NodeID .String ()
383
378
startIndex := len (ids .NodeIDPrefix )
384
379
endIndex := startIndex + 8 // 8 characters should be enough to identify a node in the context of its network
385
- return n .NetworkUUID + "-" + strings .ToLower (nodeIDString [startIndex :endIndex ])
380
+ return n .network . UUID + "-" + strings .ToLower (nodeIDString [startIndex :endIndex ])
386
381
}
387
382
388
383
// Saves the currently allocated API port to the node's configuration
0 commit comments