Documentation ¶
Index ¶
- Variables
- type Node
- func (n *Node) Init() (err error)
- func (n Node) InitAndStartTest(ctx context.Context, t *testing.T, signalTestToStop context.CancelFunc)
- func (n Node) Key() (key string)
- func (n Node) RPCPort() (port string)
- func (n *Node) Start(ctx context.Context) (runtimeError <-chan error, startErr error)
- func (n *Node) StartAndWait(ctx context.Context) (runtimeError <-chan error, startErr error)
- func (n Node) String() string
- func (n Node) WSPort() (port string)
- type Nodes
- type Option
Constants ¶
This section is empty.
Variables ¶
var (
ErrWaitTimedOut = errors.New("waiting for all nodes timed out")
)
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a structure holding all the settings to configure a Gossamer node.
func (Node) InitAndStartTest ¶
func (n Node) InitAndStartTest(ctx context.Context, t *testing.T, signalTestToStop context.CancelFunc)
InitAndStartTest is a test helper method to initialise and start the node, as well as registering appriopriate test handlers. If initialising or starting fails, cleanup is done and the test fails instantly. If the node crashes during runtime, the passed `signalTestToStop` argument is called since the test cannot be failed from outside the main test goroutine.
func (*Node) Start ¶
Start starts a Gossamer node using the node configuration of the receiving struct. It returns a start error if the node cannot be started, and runs the node until the context gets canceled. When the node crashes or is stopped, an error (nil or not) is sent in the waitErrCh.
func (*Node) StartAndWait ¶
StartAndWait starts a Gossamer node using the node configuration of the receiving struct. It returns a start error if the node cannot be started, and runs the node until the context gets canceled. When the node crashes or is stopped, an error (nil or not) is sent in the waitErrCh. It waits for the node to respond to an RPC health call before returning.
type Nodes ¶
type Nodes []Node
Nodes is a slice of nodes.
func MakeNodes ¶
MakeNodes creates `num` nodes using the `tomlConfig` as a base config for each node. It overrides some of configuration: - the index of each node is incremented per node (overrides the SetIndex option, if set)
func (Nodes) InitAndStartTest ¶
func (nodes Nodes) InitAndStartTest(ctx context.Context, t *testing.T, signalTestToStop context.CancelFunc)
InitAndStartTest is a test helper method to initialise and start nodes, as well as registering appriopriate test handlers. If any node fails to initialise or start, cleanup is done and the test is instantly failed. If any node crashes at runtime, all other nodes are shutdown, cleanup is done and the passed argument `signalTestToStop` is called to signal to the main test goroutine to stop.
func (Nodes) Start ¶
Start starts all the nodes and returns the number of started nodes and an eventual start error. The started number should be used by the caller to wait for `started` errors coming from the wait error channel. All the nodes are stopped when the context is canceled, and `started` errors will be sent in the waitErr channel.