iptbtester

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2021 License: Apache-2.0, MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustImportGenesisMiner

func MustImportGenesisMiner(tn *TestNode, gi *GenesisInfo)

MustImportGenesisMiner configures a node from the GenesisInfo and starts it mining. The node should already be initialized with the GenesisFile, and be should started.

func NewIPTBTestbed

func NewIPTBTestbed(count int, typ, dir string, attrs map[string]string) (iptb.Testbed, error)

NewIPTBTestbed creates an iptb testebed of size `count`. "localfilecoin" or "dockerfilecoin" may be passed for `type`.

func ReadSetup

func ReadSetup(t *testing.T, setupPath string) *gengen.GenesisCfg

ReadSetup reads genesis config from a setup file

Types

type GenesisInfo

type GenesisInfo struct {
	GenesisFile        string
	KeyFile            string
	WalletAddress      string
	MinerAddress       string
	SectorsDir         string
	PresealedSectorDir string
}

GenesisInfo chains require information to start a single node with funds

func RequireGenerateGenesis

func RequireGenerateGenesis(t *testing.T, funds int64, dir string, genesisTime time.Time) *GenesisInfo

RequireGenerateGenesis constructs the required information and files to build a single filecoin node with the provided funds. The GenesisInfo can be used with MustImportGenesisMiner

func RequireGenesis

func RequireGenesis(t *testing.T, dir string, cfg *gengen.GenesisCfg) *GenesisInfo

RequireGenesis generates a genesis block and metadata from config

func RequireGenesisFromSetup

func RequireGenesisFromSetup(t *testing.T, dir string, setupPath string) *GenesisInfo

RequireGenesisFromSetup constructs the required information and files to build a single filecoin node from a genesis configuration file. The GenesisInfo can be used with MustImportGenesisMiner

type TestNode

type TestNode struct {
	iptb.Testbed
	testbedi.Core

	T *testing.T
}

TestNode is a wrapper around an iptb core node interface.

func NewTestNodes

func NewTestNodes(t *testing.T, count int, attrs map[string]string) ([]*TestNode, error)

NewTestNodes returns `count` TestNodes, and error is returned if a failure is encoundered.

func (*TestNode) MustConnect

func (tn *TestNode) MustConnect(ctx context.Context, peer *TestNode)

MustConnect will connect TestNode to TestNode `peer`, testing.Fatal will be called if connecting fails.

func (*TestNode) MustInit

func (tn *TestNode) MustInit(ctx context.Context, args ...string) *TestNode

MustInit inits TestNode, passing `args` to the init command. testing.Fatal is called if initing fails, or exits with and exitcode > 0.

func (*TestNode) MustInitWithGenesis

func (tn *TestNode) MustInitWithGenesis(ctx context.Context, genesisinfo *GenesisInfo, args ...string) *TestNode

MustInitWithGenesis init TestNode, passing in the `--genesisfile` flag, by calling MustInit

func (*TestNode) MustRunCmd

func (tn *TestNode) MustRunCmd(ctx context.Context, args ...string) (stdout, stderr string)

MustRunCmd runs `args` against TestNode. MustRunCmd returns stderr and stdout after running the command successfully. If the command exits with an exitcode > 0, the MustRunCmd will call testing.Fatal and print the error.

func (*TestNode) MustRunCmdJSON

func (tn *TestNode) MustRunCmdJSON(ctx context.Context, expOut interface{}, args ...string)

MustRunCmdJSON runs `args` against TestNode. The '--enc=json' flag is appened to the command specified by `args`, the result of the command is marshaled into `expOut`.

func (*TestNode) MustStart

func (tn *TestNode) MustStart(ctx context.Context, args ...string) *TestNode

MustStart starts TestNode, testing.Fatal is called if starting fails, or exits with and exitcode > 0.

func (*TestNode) MustStop

func (tn *TestNode) MustStop(ctx context.Context)

MustStop stops TestNode, testing.Fatal is called if stopping fails.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL