Documentation ¶
Overview ¶
Package rpctest ....
Index ¶
- type Harness
- func (h *Harness) FullNodeCommand() string
- func (h *Harness) FullWalletCommand() string
- func (h *Harness) GenerateBlock(startHeight uint32) ([]*chainhash.Hash, error)
- func (h *Harness) IsUp() bool
- func (h *Harness) RPCCertFile() string
- func (h *Harness) RPCConfig() rpc.ConnConfig
- func (h *Harness) RPCWalletCertFile() string
- func (h *Harness) RPCWalletConfig() rpc.ConnConfig
- func (h *Harness) SetUp(createTestChain bool, numMatureOutputs uint32) error
- func (h *Harness) TearDown() error
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) FullNodeCommand ¶ added in v0.5.0
FullNodeCommand returns the full command line of the node
func (*Harness) FullWalletCommand ¶ added in v0.5.0
FullWalletCommand returns the full command line of the wallet
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) RPCCertFile ¶ added in v0.5.0
RPCCertFile returns the full path the node RPC's TLS certifiate
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) RPCWalletCertFile ¶ added in v0.5.0
RPCWalletCertFile returns the full path the wallet RPC's TLS certifiate
func (*Harness) RPCWalletConfig ¶ added in v0.5.0
func (h *Harness) RPCWalletConfig() rpc.ConnConfig
RPCWalletConfig 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.