zcashd/qa/rpc-tests
MarcoFalke fa44509d6c [qa] keypool: Fix white space to prepare transition to test framework 2020-11-21 02:33:27 +00:00
..
golden Update golden test for heartwood network upgrade. 2020-05-07 19:12:24 -06:00
test_framework Add p2p-fullblocktest.py 2020-11-20 03:32:53 +00:00
.gitignore Python-based regression tests 2014-02-28 15:24:31 -05:00
README.md [qa] Split README.md to /qa and /qa/rpc-tests 2020-11-21 02:33:27 +00:00
addressindex.py allow getaddressutxos if -lightwalletd 2020-10-19 11:26:16 -06:00
bip65-cltv-p2p.py Add p2p-fullblocktest.py 2020-11-20 03:32:53 +00:00
bipdersig-p2p.py Add p2p-fullblocktest.py 2020-11-20 03:32:53 +00:00
blockchain.py Merge remote-tracking branch 'upstream/master' into zip-207 2020-07-09 08:23:57 -06:00
coinbase_funding_streams.py Fix pyflakes. 2020-07-02 16:54:49 -06:00
decodescript.py Update hexlify for encoding, update to py3 io module 2020-02-09 08:14:21 -08:00
disablewallet.py Update py3 env path, remove py2 assert 2020-02-09 08:14:21 -08:00
feature_logging.py fix test cases 2020-05-28 10:58:04 -03:00
feature_walletfile.py Fix typos 2020-09-25 10:49:57 +03:00
feature_zip221.py Remove unused imports. 2020-05-05 11:41:06 -06:00
finalsaplingroot.py add z_gettreestate rpc 2020-10-26 23:08:47 -06:00
forknotify.py test: Explicitly set encoding to utf8 when opening text files 2020-11-09 22:59:04 +00:00
framework.py remove unused import 2020-03-19 08:46:33 -03:00
fundrawtransaction.py [rpc-tests] fundrawtransaction: Update fee after minRelayTxFee increase 2020-11-20 03:32:53 +00:00
getblocktemplate.py Update py2 env path, remove py2 assert 2020-02-09 08:14:21 -08:00
getblocktemplate_longpoll.py Add basic coverage reporting for RPC tests 2020-03-24 21:51:51 +13:00
getblocktemplate_proposals.py Update ignored testScriptsExt to Python3 2020-02-09 08:14:21 -08:00
getchaintips.py Update py2 env path, remove py2 assert 2020-02-09 08:14:21 -08:00
getrawtransaction_insight.py Update py2 env path, remove py2 assert, update filter to return list for py3 2020-02-09 08:14:21 -08:00
hardforkdetection.py python: Explicitly set encoding to utf8 when opening text files 2020-11-09 23:06:21 +00:00
httpbasics.py QA: Fix backporting bugs in httpbasics.py 2020-10-01 13:44:21 +01:00
invalidateblock.py Update ignored testScriptsExt to Python3 2020-02-09 08:14:21 -08:00
invalidblockrequest.py Add p2p-fullblocktest.py 2020-11-20 03:32:53 +00:00
key_import_export.py Update cmp to py3 functions, update map return to list for py3 2020-02-09 08:14:21 -08:00
keypool.py [qa] keypool: Fix white space to prepare transition to test framework 2020-11-21 02:33:27 +00:00
listtransactions.py Remove unused import in qa/rpc-tests/listtransactions.py 2020-06-03 12:25:31 +01:00
maxblocksinflight.py Update ignored testScriptsExt to Python3 2020-02-09 08:14:21 -08:00
mempool_limit.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
mempool_nu_activation.py Fix decimal 0 issues 2020-02-09 08:17:32 -08:00
mempool_reorg.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
mempool_resurrect_test.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
mempool_spendcoinbase.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
mempool_tx_expiry.py remove space after new line 2020-03-07 09:26:25 -03:00
mergetoaddress_helper.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
mergetoaddress_mixednotes.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
mergetoaddress_sapling.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
mergetoaddress_sprout.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
merkle_blocks.py Auto merge of #4280 - oxarbitrage:issue2197, r=daira 2020-03-05 16:36:32 +00:00
mining_shielded_coinbase.py Implement zip-207 and zip-214. 2020-06-25 16:15:50 -06:00
multi_rpc.py test: Explicitly set encoding to utf8 when opening text files 2020-11-09 22:59:04 +00:00
nodehandling.py clean-up imports, keep string notation consistent, remove spacing 2020-02-09 08:15:43 -08:00
p2p-acceptblock.py Add p2p-fullblocktest.py 2020-11-20 03:32:53 +00:00
p2p-fullblocktest.py Add p2p-fullblocktest.py 2020-11-20 03:32:53 +00:00
p2p_node_bloom.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
p2p_nu_peer_management.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
p2p_txexpiringsoon.py update io module, fix py3 division, and string encoding 2020-02-09 08:15:43 -08:00
p2p_txexpiry_dos.py Update to py3, ISSUE with encoding 2020-02-09 08:15:43 -08:00
paymentdisclosure.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
post_heartwood_rollback.py Missing NU4->Canopy renames. 2020-05-29 10:02:50 +01:00
prioritisetransaction.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
proxy_test.py update to py3 conventions, preserve ipv6 patch 2020-02-09 08:14:21 -08:00
pruning.py Update ignored testScriptsExt to Python3 2020-02-09 08:14:21 -08:00
rawtransactions.py add myblockhash parameter to getrawtransaction 2020-06-15 19:33:49 -03:00
receivedby.py update docs 2020-05-30 10:34:03 -03:00
regtest_signrawtransaction.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
reindex.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
remove_sprout_shielding.py Remove unused imports from remove_sprout_shielding RPC test. 2020-07-02 11:09:22 -06:00
reorg_limit.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
rest.py Fixed multiple typos 2020-09-23 00:07:48 +01:00
rewind_index.py Narrow down the test case. 2020-04-14 17:47:29 -06:00
rpcbind_test.py Add basic coverage reporting for RPC tests 2020-03-24 21:51:51 +13:00
sapling_rewind_check.py python: Explicitly set encoding to utf8 when opening text files 2020-11-09 23:06:21 +00:00
shorter_block_times.py fix type issue 2020-02-09 08:15:43 -08:00
signrawtransaction_offline.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
signrawtransactions.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
smartfees.py Fixed multiple typos 2020-09-23 00:07:48 +01:00
spentindex.py Update to py3 conventions, update filter to return list 2020-02-09 08:14:21 -08:00
sprout_sapling_migration.py Update type to be decimal 2020-02-09 08:15:43 -08:00
timestampindex.py update to py3 conventions, update range to return list for py3 2020-02-09 08:14:21 -08:00
turnstile.py preserve test semantics 2020-03-18 22:49:44 -03:00
tx_expiry_helper.py fix pyflakes errors 2020-02-09 08:18:00 -08:00
txn_doublespend.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
upgrade_golden.py Rename golden/nu4.tar.gz to canopy.tar.gz. 2020-05-29 01:30:30 +01:00
wallet.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
wallet_1941.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
wallet_addresses.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
wallet_anchorfork.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
wallet_changeaddresses.py clean up conventions and whitespace 2020-02-09 08:44:23 -08:00
wallet_changeindicator.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
wallet_db_flush.py fix pyflakes CI errors 2020-07-02 14:32:48 -06:00
wallet_import_export.py python: Explicitly set encoding to utf8 when opening text files 2020-11-09 23:06:21 +00:00
wallet_listnotes.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
wallet_listreceived.py remove additional not needed casts from py tests 2020-05-18 18:09:07 -03:00
wallet_nullifiers.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
wallet_overwintertx.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
wallet_persistence.py Store imported Sapling ExtFVKs in wallet database 2020-02-21 01:32:15 +00:00
wallet_sapling.py add expected address check to tests 2020-04-07 10:39:33 -03:00
wallet_sendmany_any_taddr.py wallet: Ignore coinbase UTXOs with z_sendmany ANY_TADDR 2020-09-22 17:45:09 +01:00
wallet_shieldcoinbase.py fix pyflakes errors 2020-02-09 08:18:00 -08:00
wallet_shieldcoinbase_sapling.py fix pyflakes errors 2020-02-09 08:18:00 -08:00
wallet_shieldcoinbase_sprout.py fix pyflakes errors 2020-02-09 08:18:00 -08:00
wallet_shieldingcoinbase.py rpc_wallet_tests: changed "Insufficient funds" error message to a proper "Insufficient transparent funds". This is because we are now throwing the insufficient transparent balance rpc error inside load_utxo. 2020-11-13 10:23:59 -03:00
wallet_treestate.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
walletbackup.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
zapwallettxes.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
zcjoinsplit.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
zcjoinsplitdoublespend.py Standard py2 to py3 updates 2020-02-09 08:14:21 -08:00
zkey_import_export.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
zmq_test.py fix pyflakes errors 2020-02-09 08:18:00 -08:00

README.md

Regression tests

test_framework/test_framework.py

Base class for RPC regression tests.

test_framework/util.py

Generally useful functions.

test_framework/mininode.py

Basic code to support p2p connectivity to a bitcoind.

test_framework/comptool.py

Framework for comparison-tool style, p2p tests.

test_framework/script.py

Utilities for manipulating transaction scripts (originally from python-bitcoinlib)

test_framework/blockstore.py

Implements disk-backed block and tx storage.

test_framework/key.py

Wrapper around OpenSSL EC_Key (originally from python-bitcoinlib)

test_framework/bignum.py

Helpers for script.py

test_framework/blocktools.py

Helper functions for creating blocks and transactions.

P2P test design notes

Mininode

  • mininode.py contains all the definitions for objects that pass over the network (CBlock, CTransaction, etc, along with the network-level wrappers for them, msg_block, msg_tx, etc).

  • P2P tests have two threads. One thread handles all network communication with the bitcoind(s) being tested (using python's asyncore package); the other implements the test logic.

  • NodeConn is the class used to connect to a bitcoind. If you implement a callback class that derives from NodeConnCB and pass that to the NodeConn object, your code will receive the appropriate callbacks when events of interest arrive. NOTE: be sure to call self.create_callback_map() in your derived classes' __init__ function, so that the correct mappings are set up between p2p messages and your callback functions.

  • You can pass the same handler to multiple NodeConn's if you like, or pass different ones to each -- whatever makes the most sense for your test.

  • Call NetworkThread.start() after all NodeConn objects are created to start the networking thread. (Continue with the test logic in your existing thread.)

  • RPC calls are available in p2p tests.

  • Can be used to write free-form tests, where specific p2p-protocol behavior is tested. Examples: p2p-accept-block.py, maxblocksinflight.py.

Comptool

  • Testing framework for writing tests that compare the block/tx acceptance behavior of a bitcoind against 1 or more other bitcoind instances, or against known outcomes, or both.

  • Set the num_nodes variable (defined in ComparisonTestFramework) to start up 1 or more nodes. If using 1 node, then --testbinary can be used as a command line option to change the bitcoind binary used by the test. If using 2 or more nodes, then --refbinary can be optionally used to change the bitcoind that will be used on nodes 2 and up.

  • Implement a (generator) function called get_tests() which yields TestInstances. Each TestInstance consists of:

    • a list of [object, outcome, hash] entries
      • object is a CBlock, CTransaction, or CBlockHeader. CBlock's and CTransaction's are tested for acceptance. CBlockHeaders can be used so that the test runner can deliver complete headers-chains when requested from the bitcoind, to allow writing tests where blocks can be delivered out of order but still processed by headers-first bitcoind's.
      • outcome is True, False, or None. If True or False, the tip is compared with the expected tip -- either the block passed in, or the hash specified as the optional 3rd entry. If None is specified, then the test will compare all the bitcoind's being tested to see if they all agree on what the best tip is.
      • hash is the block hash of the tip to compare against. Optional to specify; if left out then the hash of the block passed in will be used as the expected tip. This allows for specifying an expected tip while testing the handling of either invalid blocks or blocks delivered out of order, which complete a longer chain.
    • sync_every_block: True/False. If False, then all blocks are inv'ed together, and the test runner waits until the node receives the last one, and tests only the last block for tip acceptance using the outcome and specified tip. If True, then each block is tested in sequence and synced (this is slower when processing many blocks).
    • sync_every_transaction: True/False. Analogous to sync_every_block, except if the outcome on the last tx is "None", then the contents of the entire mempool are compared across all bitcoind connections. If True or False, then only the last tx's acceptance is tested against the given outcome.
  • For examples of tests written in this framework, see invalidblockrequest.py and p2p-fullblocktest.py.