Documentation ¶
Overview ¶
Package rpctest ....
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Harness ¶
type Harness struct { ActiveNet *chaincfg.Params Node *rpc.Client WalletRPC *rpc.Client // contains filtered or unexported fields }
Harness fully encapsulates an active dcrd process, along with an embedded dcrwallet to provide a unified platform for creating RPC-driven integration tests involving dcrd. The active dcrd node will typically be run in simnet mode to allow for easy generation of test blockchains. Additionally, a special method is provided which allows one to easily generate coinbase spends. The active dcrd process is fully managed by Harness, which handles the necessary initialization, and teardown of the process along with any temporary directories created as a result. Multiple Harness instances may be run concurrently, to allow for testing complex scenarios involving multuple nodes.
func NewHarness ¶
func NewHarness(activeNet *chaincfg.Params, handlers *rpc.NotificationHandlers, extraArgs []string) (*Harness, error)
NewHarness creates and initializes a new instance of the rpc test harness. Optionally, websocket handlers and a specified configuration may be passed. In the case that a nil configuration is passed, a default configuration will be used.
NOTE: This function is safe for concurrent access.
func (*Harness) GenerateBlock ¶
GenerateBlock is a helper function to ensure that the chain has actually incremented due to FORK blocks after stake voting height that may occur.
func (*Harness) RPCConfig ¶
func (h *Harness) RPCConfig() rpc.ConnConfig
RPCConfig returns the harnesses current rpc configuration. This allows other potential RPC clients created within tests to connect to a given test harness instance.
func (*Harness) SetUp ¶
SetUp initializes the rpc test state. Initialization includes: starting up a simnet node, creating a websocket client and connecting to the started node, and finally: optionally generating and submitting a testchain with a configurable number of mature coinbase outputs coinbase outputs.