6cf60b5fae
This corrects several issues with the new rpctest package. The following is an overview of the issues that have been corrected: - The JoinNodes code was incorrect for both mempool and blocks. - For mempool it was only checking the first node against itself - For blocks it was only testing the height instead of hash and height which means the chains could be different and it would claim they're synced - The test for mempool joins was inaccurate in a few ways: - It was generating separate chains such that the generated transaction was invalid (an orphan) on one chain, but not the other - Mempools are not automatically synced when nodes are connected and there is a large random delay before any transaction rebroadcast happens, so it can't be relied on for the purposes of this test - The test for block joins was generating two independent chains of the same height with the same difficulty and was only passing due to the aforementioned bug in JoinNodes - All of the ConnectNode calls were connecting the main harness outbound to the local test harness instances - This is not correct because ConnectNode makes the outbound connection persistent, which means once the local test harness is gone, it would keep trying to connect for the remainder of the tests to a node that is never coming back and instead ends up connecting to an independent test harness. |
||
---|---|---|
.. | ||
blockgen.go | ||
doc.go | ||
memwallet.go | ||
node.go | ||
README.md | ||
rpc_harness.go | ||
rpc_harness_test.go | ||
utils.go |
rpctest
[] (https://travis-ci.org/btcsuite/btcd) ![ISC License] (http://img.shields.io/badge/license-ISC-blue.svg) [] (http://godoc.org/github.com/btcsuite/btcd/rpctest)
Package rpctest provides a btcd-specific RPC testing harness crafting and
executing integration tests by driving a btcd
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
btcd
. However, the constructs presented are general enough to be adapted to
any project wishing to programmatically drive a btcd
instance of its
systems/integration tests.
Installation and Updating
$ go get -u github.com/btcsuite/btcd/rpctest
License
Package rpctest is licensed under the copyfree ISC License.