engine

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EnableHarness a test CLI param to enable harness bootstrapping
	EnableHarness = flag.Bool("enable", false, "Enable Test Harness bootstrapping")
	// RPCNetworkType a test CLI param to set jsonrpc network type (unix or tcp)
	RPCNetworkType = flag.String("rpc_transport", "unix", "JSON-RPC transport type (unix/tcp)")
	// KeepAlive a test CLI param to keep harness running even after all  tests have passed
	// It's useful when additional manual tests should be done
	KeepAlive = flag.Bool("keepalive", false, "Keep Test Harness alive after tests pass")

	// ErrDisabledHarness yields a disabled test harness
	ErrDisabledHarness = errors.New("disabled test harness")
)

Functions

func ConstructWireFrame

func ConstructWireFrame(magic protocol.Magic, cmd topics.Topic, payload *bytes.Buffer) ([]byte, error)

ConstructWireFrame creates a frame according to the wire protocol

func Profile1

func Profile1(index int, node *DuskNode, walletPath string)

Profile1 builds the default dusk.toml definition

func Profile2

func Profile2(index int, node *DuskNode, walletPath string)

Profile2 builds dusk.toml with lite driver enabled (suitable for bench testing)

func WriteFrame

func WriteFrame(buf *bytes.Buffer) (*bytes.Buffer, error)

WriteFrame writes a frame to a buffer TODO: remove *bytes.Buffer from the returned parameters

Types

type DuskNode

type DuskNode struct {
	Id              string //nolint
	ConfigProfileID string

	// fields represents a dusk-blockchain instance
	Cfg config.Registry
	Gql *graphql.Client

	// dusk-blockchain node directory
	Dir string
}

DuskNode is the struct representing a node instance in the local Network

func NewDuskNode

func NewDuskNode(graphqlPort, nodeID int, profileID string) *DuskNode

NewDuskNode instantiates a new DuskNode

type Network

type Network struct {
	Nodes []*DuskNode
	// contains filtered or unexported fields
}

Network describes the current network configuration in terms of nodes and processes

func (*Network) Bootstrap

func (n *Network) Bootstrap(workspace string) error

Bootstrap performs all actions needed to initialize and start a local network This network is alive by the end of all tests execution

func (*Network) LoadWalletCmd added in v0.3.0

func (n *Network) LoadWalletCmd(ind uint, password string) (string, error)

LoadWalletCmd sends gRPC command LoadWallet and returns pubkey (if loaded)

func (*Network) PublishTopic

func (n *Network) PublishTopic(nodeIndex uint, topic, payload string) error

PublishTopic publishes an event bus topic to the specified node via rpc call

func (*Network) SendBidCmd added in v0.3.0

func (n *Network) SendBidCmd(ind uint, amount, locktime uint64) ([]byte, error)

SendBidCmd sends gRPC command SendBid and returns tx hash

func (*Network) SendQuery

func (n *Network) SendQuery(nodeIndex uint, query string, result interface{}) error

SendQuery sends a graphql query to the specified network node

func (*Network) SendWireMsg

func (n *Network) SendWireMsg(ind uint, msg []byte, writeTimeout int) error

SendWireMsg sends a P2P message to the specified network node NB: Handshaking procedure must be performed prior to the message sending

func (*Network) StartNode added in v0.3.0

func (n *Network) StartNode(i int, node *DuskNode, workspace string) error

StartNode locally

func (*Network) Teardown

func (n *Network) Teardown()

Teardown the network

func (*Network) WaitUntil added in v0.3.0

func (n *Network) WaitUntil(t *testing.T, ind uint, targetHeight uint64, waitFor time.Duration, tick time.Duration)

WaitUntil blocks until the node at index ind reaches the target height

func (*Network) WaitUntilTx added in v0.3.0

func (n *Network) WaitUntilTx(t *testing.T, ind uint, txID string) string

WaitUntilTx blocks until the node at index ind accepts the specified Tx Returns hash of the block that includes this tx

type Profiles

type Profiles map[string]func(index int, node *DuskNode, walletPath string)

Profiles is a map with the node name as key and Profile function

Jump to

Keyboard shortcuts

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