# README
rpctest
Package rpctest provides a bted-specific RPC testing harness crafting and
executing integration tests by driving a bted
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
bted
. However, the constructs presented are general enough to be adapted to
any project wishing to programmatically drive a bted
instance of its
systems/integration tests.
Installation and Updating
$ go get -u github.com/bitweb-project/bted/integration/rpctest
License
Package rpctest is licensed under the copyfree ISC License.
# Functions
ActiveHarnesses returns a slice of all currently active test harnesses.
ConnectNode establishes a new peer-to-peer connection between the "from" harness and the "to" harness.
CreateBlock creates a new block building from the previous block with a specified blockversion and timestamp.
JoinNodes is a synchronization tool used to block until all passed nodes are fully synced with respect to an attribute.
New creates and initializes new instance of the rpc test harness.
NextAvailablePort returns the first port that is available for listening by a new node.
TearDownAll tears down all active test harnesses.
# Constants
Blocks is a JoinType which waits until all nodes share the same block height.
BlockVersion is the default block version used when generating blocks.
DefaultConnectionRetryTimeout is the default duration we wait between two connection attempts.
DefaultMaxConnectionRetries is the default number of times we re-try to connect to the node after starting it.
Mempools is a JoinType which blocks until all nodes have identical mempool.
# Variables
ListenAddressGenerator is a function that is used to generate two listen addresses (host:port), one for the P2P listener and one for the RPC listener.
ListenerFormat is the format string that is used to generate local listener addresses.
# Structs
Harness fully encapsulates an active bted process to provide a unified platform for creating rpc driven integration tests involving bted.
# Type aliases
HarnessTestCase represents a test-case which utilizes an instance of the Harness to exercise functionality.
JoinType is an enum representing a particular type of "node join".