fastesting

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertStdErrContains

func AssertStdErrContains(t *testing.T, fast *fast.Filecoin, expected string)

AssertStdErrContains verifies that the last command stderr of 'fast' contains the string 'expected'

Types

type DeploymentEnvironment

type DeploymentEnvironment struct {
	environment.Environment
	// contains filtered or unexported fields
}

DeploymentEnvironment provides common setup for writing tests which will run against a deployed network using FAST

func NewDeploymentEnvironment

func NewDeploymentEnvironment(ctx context.Context, t *testing.T, network string, fastenvOpts fast.FilecoinOpts) (context.Context, *DeploymentEnvironment)

NewDeploymentEnvironment creates a DeploymentEnvironment with a basic setup for writing tests using the FAST library. DeploymentEnvironment also supports testing locally using the `local` network which will handle setting up a mining node and updating bootstrap peers. The local network runs at 5 second blocktimes.

func (*DeploymentEnvironment) DumpEnvOutputOnFail

func (env *DeploymentEnvironment) DumpEnvOutputOnFail()

DumpEnvOutputOnFail calls `DumpLastOutput for each process if the test failed.

func (*DeploymentEnvironment) RequireNewNodeStarted

func (env *DeploymentEnvironment) RequireNewNodeStarted() *fast.Filecoin

RequireNewNodeStarted builds a new node using RequireNewNode, then initializes and starts it

func (*DeploymentEnvironment) RequireNewNodeWithFunds

func (env *DeploymentEnvironment) RequireNewNodeWithFunds() *fast.Filecoin

RequireNewNodeWithFunds builds a new node using RequireNewNodeStarted, then sends it funds from the environment GenesisMiner node

func (*DeploymentEnvironment) Teardown

func (env *DeploymentEnvironment) Teardown(ctx context.Context) error

Teardown stops all of the nodes and cleans up the environment. If the test failed, it will also print the last output of each process by calling `DumpLastOutput`. Output is logged using the Log method on the testing.T

type TestEnvironment

type TestEnvironment struct {
	environment.Environment

	GenesisMiner *fast.Filecoin
	// contains filtered or unexported fields
}

TestEnvironment provides common setup for writing tests using FAST

func NewTestEnvironment

func NewTestEnvironment(ctx context.Context, t *testing.T, fastenvOpts fast.FilecoinOpts) (context.Context, *TestEnvironment)

NewTestEnvironment creates a TestEnvironment with a basic setup for writing tests using the FAST library.

func (*TestEnvironment) DumpEnvOutputOnFail

func (env *TestEnvironment) DumpEnvOutputOnFail()

DumpEnvOutputOnFail calls `DumpLastOutput for each process if the test failed.

func (*TestEnvironment) RequireNewNode

func (env *TestEnvironment) RequireNewNode() *fast.Filecoin

RequireNewNode builds a new node for the environment

func (*TestEnvironment) RequireNewNodeConnected

func (env *TestEnvironment) RequireNewNodeConnected() *fast.Filecoin

RequireNewNodeConnected builds a new node using RequireNewNodeStarted, then connect it to the environment GenesisMiner node

func (*TestEnvironment) RequireNewNodeStarted

func (env *TestEnvironment) RequireNewNodeStarted() *fast.Filecoin

RequireNewNodeStarted builds a new node using RequireNewNode, then initializes and starts it

func (*TestEnvironment) RequireNewNodeWithFunds

func (env *TestEnvironment) RequireNewNodeWithFunds(funds int) *fast.Filecoin

RequireNewNodeWithFunds builds a new node using RequireNewNodeStarted, then sends it funds from the environment GenesisMiner node

func (*TestEnvironment) RunAsyncMiner

func (env *TestEnvironment) RunAsyncMiner() context.Context

RunAsyncMiner unset MiningOnce for conflict

func (*TestEnvironment) Teardown

func (env *TestEnvironment) Teardown(ctx context.Context) error

Teardown stops all of the nodes and cleans up the environment. If the test failed, it will also print the last output of each process by calling `DumpLastOutput`. Output is logged using the Log method on the testing.T

Jump to

Keyboard shortcuts

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