Documentation ¶
Index ¶
- Variables
- func ConnectNodes(t *testing.T, a, b *node.Node)
- func CreateBootstrapMiner(ctx context.Context, t *testing.T, seed *ChainSeed, ...) *node.Node
- func DefaultAddressConfigOpt(addr address.Address) node.ConfigOpt
- func FakeProofVerifierBuilderOpts() []node.BuilderOpt
- func MakeTestGenCfg(t *testing.T, numSectors int) *gengen.GenesisCfg
- func StartNodes(t *testing.T, nds []*node.Node)
- func StopNodes(nds []*node.Node)
- type ChainSeed
- func (cs *ChainSeed) Addr(t *testing.T, key int) address.Address
- func (cs *ChainSeed) GenesisInitFunc(cst cbor.IpldStore, bs blockstoreutil.Blockstore) (*types.BlockHeader, error)
- func (cs *ChainSeed) GiveKey(ctx context.Context, t *testing.T, nd *node.Node, key int) address.Address
- func (cs *ChainSeed) GiveMiner(t *testing.T, nd *node.Node, which int) (address.Address, address.Address)
- 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 MustCreateStorageMinerResult
- 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
Constants ¶
This section is empty.
Variables ¶
var PeerKeys = []crypto.PrivKey{
mustGenKey(101),
mustGenKey(102),
}
PeerKeys are a list of keys for peers that can be used in testing.
Functions ¶
func ConnectNodes ¶
ConnectNodes connects two nodes together
func CreateBootstrapMiner ¶
func DefaultAddressConfigOpt ¶
DefaultAddressConfigOpt is a node config option setting the default address
func FakeProofVerifierBuilderOpts ¶
func FakeProofVerifierBuilderOpts() []node.BuilderOpt
FakeProofVerifierBuilderOpts returns default configuration for testing
func MakeTestGenCfg ¶
func MakeTestGenCfg(t *testing.T, numSectors int) *gengen.GenesisCfg
MakeTestGenCfg returns a genesis configuration used for tests. This config has one miner with numSectors sectors and two accounts, the first is the miner's owner/worker and the accounts both have 10000 FIL
func StartNodes ¶
StartNodes starts some nodes, failing on any error.
Types ¶
type ChainSeed ¶
type ChainSeed struct {
// contains filtered or unexported fields
}
ChainSeed is a generalized struct for configuring node
func CreateBootstrapSetup ¶
func CreateBootstrapSetup(t *testing.T) (*ChainSeed, *gengen.GenesisCfg, clock.ChainEpochClock)
func FixtureChainSeed ¶
FixtureChainSeed returns the genesis function that
func MakeChainSeed ¶
func MakeChainSeed(t *testing.T, cfg *gengen.GenesisCfg) *ChainSeed
MakeChainSeed creates a chain seed struct (see above) from a given genesis config
func (*ChainSeed) GenesisInitFunc ¶
func (cs *ChainSeed) GenesisInitFunc(cst cbor.IpldStore, bs blockstoreutil.Blockstore) (*types.BlockHeader, error)
GenesisInitFunc is a th.GenesisInitFunc using the chain seed
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 MustCreateStorageMinerResult ¶
type MustCreateStorageMinerResult struct { MinerAddress *address.Address Err error }
MustCreateStorageMinerResult contains the result of a CreateStorageMiner command
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.configModule structure, and node.configModule 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.