Documentation ¶
Overview ¶
Package rpctest provides a hcd-specific RPC testing harness crafting and executing integration tests by driving a `hcd` instance via the `RPC` interface. Each instance of an active harness comes equipped with a simple in-memory HD wallet capable of properly syncing to the generated chain, creating new addresses, and crafting fully signed transactions paying to an arbitrary set of outputs.
This package was designed specifically to act as an RPC testing harness for `hcd`. However, the constructs presented are general enough to be adapted to any project wishing to programmatically drive a `hcd` instance of its systems/integration tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectNode ¶
func ConnectNode(from *Harness, to *Harness) error
ConnectNode establishes a new peer-to-peer connection between the "from" harness and the "to" harness. The connection made is flagged as persistent, therefore in the case of disconnects, "from" will attempt to reestablish a connection to the "to" harness.
func JoinNodes ¶
JoinNodes is a synchronization tool used to block until all passed nodes are fully synced with respect to an attribute. This function will block for a period of time, finally returning once all nodes are synced according to the passed JoinType. This function be used to to ensure all active test harnesses are at a consistent state before proceeding to an assertion or check within rpc tests.
func NodesConnected ¶
NodesConnected verifies whether there is a connection via the p2p interface between the specified nodes. If allowReverse is true, connectivity is also checked in the reverse direction (to->from).
func RemoveNode ¶
func RemoveNode(from *Harness, to *Harness) error
RemoveNode removes the peer-to-peer connection between the "from" harness and the "to" harness. The connection is only removed in this direction, therefore if the reverse connection exists, the nodes may still be connected.
This function returns an error if the nodes were not previously connected.