Documentation ¶
Index ¶
- func MustCreateNodesWithBootstrap(ctx context.Context, t *testing.T, additionalNodes uint) ([]*node.Node, context.CancelFunc)
- type Client
- func (c *Client) Address() string
- func (c *Client) Run(ctx context.Context, command ...string) *th.CmdOutput
- func (c *Client) RunFail(ctx context.Context, err string, command ...string) *th.CmdOutput
- func (c *Client) RunJSON(ctx context.Context, command ...string) map[string]interface{}
- func (c *Client) RunMarshaledJSON(ctx context.Context, result interface{}, command ...string)
- func (c *Client) RunSuccess(ctx context.Context, command ...string) *th.CmdOutput
- func (c *Client) RunSuccessFirstLine(ctx context.Context, args ...string) string
- func (c *Client) RunSuccessLines(ctx context.Context, args ...string) []string
- type NodeAPI
- type NodeBuilder
- func (b *NodeBuilder) Build(ctx context.Context) *node.Node
- func (b *NodeBuilder) BuildAndStart(ctx context.Context) *node.Node
- func (b *NodeBuilder) BuildAndStartAPI(ctx context.Context) (*node.Node, *Client, func())
- func (b *NodeBuilder) BuildMany(ctx context.Context, numNodes int) []*node.Node
- func (b *NodeBuilder) WithBuilderOpt(opts ...node.BuilderOpt) *NodeBuilder
- func (b *NodeBuilder) WithConfig(cm node.ConfigOpt) *NodeBuilder
- func (b *NodeBuilder) WithGenesisInit(gif genesis.InitFunc) *NodeBuilder
- func (b *NodeBuilder) WithInitOpt(opts ...node.InitOpt) *NodeBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustCreateNodesWithBootstrap ¶
func MustCreateNodesWithBootstrap(ctx context.Context, t *testing.T, additionalNodes uint) ([]*node.Node, context.CancelFunc)
MustCreateNodesWithBootstrap creates an in-process test setup capable of testing communication between nodes. Every setup will have one bootstrap node (the first node that is called) that is setup to have power to mine. All of the proofs for the set-up are fake (but additional nodes will still need to create miners and add storage to gain power). All nodes will be started and connected to each other. The returned cancel function ensures all nodes are stopped when the test is over.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an in-process client to a command API.
func RunNodeAPI ¶
RunNodeAPI creates a new API server and `Run()`s it.
func (*Client) RunFail ¶
RunFail runs a command and asserts that it fails with a specified message on stderr.
func (*Client) RunMarshaledJSON ¶
RunMarshaledJSON runs a command, asserts success, and marshals the JSON response.
func (*Client) RunSuccess ¶
RunSuccess runs a command and asserts that it succeeds (status of zero and logs no errors).
func (*Client) RunSuccessFirstLine ¶
RunSuccessFirstLine executes the given command, asserts success and returns the first line of stdout.
type NodeAPI ¶
type NodeAPI struct {
// contains filtered or unexported fields
}
NodeAPI wraps an in-process Node to provide a command API server and client for testing.
func NewNodeAPI ¶
NewNodeAPI creates a wrangler for a node.
type NodeBuilder ¶
type NodeBuilder struct {
// contains filtered or unexported fields
}
NodeBuilder creates and configures Filecoin nodes for in-process testing. This is intended to replace use of GenNode and the various other node construction entry points that end up there. Note that (August 2019) there are two things called "config": the configuration read in from file to the config.Config structure, and node.Config which is really just some dependency injection. This builder avoids exposing the latter directly.
func NewNodeBuilder ¶
func NewNodeBuilder(tb testing.TB) *NodeBuilder
NewNodeBuilder creates a new node builder.
func (*NodeBuilder) Build ¶
func (b *NodeBuilder) Build(ctx context.Context) *node.Node
Build creates a node as specified by this builder. This many be invoked multiple times to create many nodes.
func (*NodeBuilder) BuildAndStart ¶
func (b *NodeBuilder) BuildAndStart(ctx context.Context) *node.Node
BuildAndStart build a node and starts it.
func (*NodeBuilder) BuildAndStartAPI ¶
BuildAndStartAPI is a convenience function composing BuildAndStart with RunNodeAPI
func (*NodeBuilder) WithBuilderOpt ¶
func (b *NodeBuilder) WithBuilderOpt(opts ...node.BuilderOpt) *NodeBuilder
WithBuilderOpt adds one or more node building options to node creation.
func (*NodeBuilder) WithConfig ¶
func (b *NodeBuilder) WithConfig(cm node.ConfigOpt) *NodeBuilder
WithConfig adds a configuration mutation function to be invoked after repo initialisation.
func (*NodeBuilder) WithGenesisInit ¶
func (b *NodeBuilder) WithGenesisInit(gif genesis.InitFunc) *NodeBuilder
WithGenesisInit sets the built nodes' genesis function.
func (*NodeBuilder) WithInitOpt ¶
func (b *NodeBuilder) WithInitOpt(opts ...node.InitOpt) *NodeBuilder
WithInitOpt adds one or more options to repo initialisation.