aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/util.py
AgeCommit message (Collapse)Author
2018-08-09[Tests] Rename create_tx and move to blocktools.pyConor Scott
2018-07-27Update copyright headers to 2018DrahtBot
2018-06-12Explicitly specify encoding when opening text files in Python codepracticalswift
2018-05-10Merge #13201: [qa] Handle disconnect_node raceMarcoFalke
09c6699900 [qa] Handle disconnect_node race (Suhas Daftuar) Pull request description: Several tests call disconnect_nodes() on each node-pair in rapid succession, resulting in a race condition if a node disconnects a peer in-between the calculation of the nodeid's to disconnect and the invocation of the disconnectnode rpc call. Handle this. Tree-SHA512: 3078cea0006fcb507c812004a777c505eb1e9dda7c6df12dbbe72395a73ff6f6760f597b6492054f5487b34534417ddef5fbad30553c135c288c4b7cfce79223
2018-05-09[qa] Handle disconnect_node raceSuhas Daftuar
Several tests call disconnect_nodes() on each node-pair in rapid succession, resulting in a race condition if a node disconnects a peer in-between the calculation of the nodeid's to disconnect and the invocation of the disconnectnode rpc call. Handle this.
2018-05-09[qa] Avoid printing to console during cache creationSuhas Daftuar
2018-05-09[Tests] Write stdout/stderr to datadir instead of temp file.John Newbery
2018-05-09Merge #12265: [test] fundrawtransaction: lock watch-only shared addressWladimir J. van der Laan
891beb0 [test] fundrawtransaction: lock watch-only shared address (Karl-Johan Alm) Pull request description: `self.nodes[0]` creates an address which is watch-only-shared with `self.nodes[3]`. If `nodes[0]` spends the associated UTXO during any of its sends later, the watchonly test will fail, as `nodes[3]` now has insufficient funds. I ran into this in #12257 and this commit is in that PR as well, but I figured I'd split it out (and remove from there once/if merged). Tree-SHA512: d04a04b1ecebe82127cccd47c1b3de311bf07f4b51dff80db20ea2f142e1d5c4a85ed6180c5c0b081d550e238c742e119b953f60f487deac5a3f3536e1a8d9fe
2018-04-11[tests] Use regtest section in functional tests configsAnthony Towns
2018-04-09[qa] Delete cookie file before starting nodeSuhas Daftuar
If a cookie file exists in a datadir prior to node startup, it must have been leftover from a prior unclean shutdown. As bitcoind will overwrite it anyway, delete it before starting up to prevent the test framework from inadvertently trying to connect using stale credentials.
2018-04-06[test] fundrawtransaction: lock watch-only shared addressKarl-Johan Alm
self.nodes[0] creates an address which is watch-only-shared with self.nodes[3]. If nodes[0] spends the associated UTXO during any of its sends later, the watchonly test will fail, as nodes[3] now has insufficient funds. Note that this also adds a new find_vout_for_address function to the test framework.
2018-03-29Merge #11773: [tests] Change feature_block.py to use BitcoinTestFrameworkWladimir J. van der Laan
265d7c4 [tests] Improve assert message when wait_until() fails (John Newbery) ebf053a [tests] Change feature_block.py to use BitcoinTestFramework (John Newbery) fc02c12 [tests] Add logging to feature_block.py (John Newbery) 3898c4f [tests] Tidy up feature_block.py (John Newbery) 5cd01d2 [tests] Fix flake8 warnings in feature_block.py (John Newbery) Pull request description: Next step in #10603. - first three commits tidy up feature_block.py - fourth commit removes usage of ComparisonTestFramework Longer term, it would be better to separate net_processing testing from validation testing, but I think this is still a useful PR, since it moves us away from the comparison test framework. Tree-SHA512: d0bb3ad22ad0aa1222877f4212bff075f9ce358e99c69c26d9913e4b346d931b8380e744434a9f6f37812c352cdaa75791691565bfeb18afcb619c06c6ca32a3
2018-03-19[tests] Improve assert message when wait_until() failsJohn Newbery
2018-03-19qa: Use node.datadir instead of tmpdir in test frameworkMarcoFalke
2018-03-15test: Use wait_until in tests where time was used for pollingBen Woosley
2018-03-14Merge #12638: qa: Cache only chain and wallet for regtest datadirWladimir J. van der Laan
fa23105 qa: Cache only chain and wallet for regtest datadir (MarcoFalke) Pull request description: mempool.dat should be empty and I don't see a need to copy it around when restoring from the cache. Tree-SHA512: f11ab69732db4dee0e9a0900570464e49085532b0cebc963877057112a7b985c477da3d32eb2093daabac9ada9e73b7c49881681ec5efa6101919b0af76001cf
2018-03-13Merge #12643: [qa] util: Remove unused sync_chainWladimir J. van der Laan
fa1436c42 [qa] util: Remove unused sync_chain (MarcoFalke) Pull request description: The util function `sync_blocks` already checks for equal chains, so we can remove the unused `sync_chain`. Also cleaned up the errors that are printed in case of timeout: ``` AssertionError: Block sync timed out: '72a3a3e9dcfd0a09204c3447af0f481d19641eeadbe6a91b8e680ed614bc7712' '5032af4ae22ae7a21afdc9d9f516877309c4dd8ef2ecadb9354be7088439b4a6' '5032af4ae22ae7a21afdc9d9f516877309c4dd8ef2ecadb9354be7088439b4a6' ``` and ``` AssertionError: Mempool sync timed out: {'c2af943d9b321c36e0f5a153a9d3d8b11bdd46ceb28e38f5fd2c722e3edb3563'} set() set() ``` Tree-SHA512: cb4ad30e3e3773072f59afa2c81cfa27bd8f389a93f02acb919990298627fcfbaa53a3d3944d827cc8a5d009871e42a47ea09e9bb93e85c22e3af6a24a574e5d
2018-03-12[qa] util: Remove unused sync_chainMarcoFalke
2018-03-07qa: Cache only chain and wallet for regtest datadirMarcoFalke
2018-03-06[tests] bind functional test nodes to 127.0.0.1Sjors Provoost
Prevents OSX firewall allow-this-application-to-accept-inbound-connections permission popups and is generally safer. To prevent binding to 127.0.0.1, set self.bind_to_localhost_only = False.
2018-02-23Merge #12443: qa: Move common args to bitcoin.confMarcoFalke
face7220b7 qa: Move common args to bitcoin.conf (MarcoFalke) Pull request description: Beside removing duplicates of the same args in the code, this actually helps with debugging after a test failure. For example, `bitcoin-qt` has `server` turned off, so you'd have to turn it on every time, if you wanted to debug a temporary test datadir created by the test framework. Also, `keypool` would fill up if you forget to specify `-keypool=1`. Tree-SHA512: 996bec8738dc0fce7297ab1fc5b4fbe3aa31b9b6241f8c4e685db728925363ccaca6145ad1edc6bee2f360e02ac4b9a53fcdff74eb79de90793393742d52b559
2018-02-23Merge #12486: [test] Round target fee to 8 decimals in assert_fee_amountWladimir J. van der Laan
42e1b5d [test] Round target fee to 8 decimals in assert_fee_amount (Karl-Johan Alm) Pull request description: The output would produce arbitrary number of decimal points, sometimes resulting in 9 decimals: ``` AssertionError: Fee of 0.00000415 BTC too low! (Should be 0.000006175 BTC) ``` The above looks like the expected fee is 6175 sats when in reality it's 618. Tree-SHA512: ddbff2926a88890d6e34a58db36f0b15a917a80064be6e40e9bcbec3f05ae6202d02adcd7873733945b043fa121d4a56dd930446ec368078fe1935cbfff898ce
2018-02-20[test] Round target fee to 8 decimals in assert_fee_amountKarl-Johan Alm
The output would produce arbitrary number of decimal points, sometimes resulting in 9 decimals: AssertionError: Fee of 0.00000415 BTC too low! (Should be 0.000006175 BTC) The above looks like the expected fee is 6175 sats when in reality it's 618.
2018-02-17scripted-diff: change signrawtransaction to signrawtransactionwithwallet in ↵Andrew Chow
tests -BEGIN VERIFY SCRIPT- sed -i 's/\<signrawtransaction\>/signrawtransactionwithwallet/g' test/functional/*.py sed -i 's/\<signrawtransaction\>/signrawtransactionwithwallet/g' test/functional/test_framework/*.py -END VERIFY SCRIPT-
2018-02-17Split signrawtransaction into wallet and non-walletAndrew Chow
Splits signrwatransaction into a wallet version (signrawtransactionwithwallet) and non-wallet version (signrawtransactionwithkey). signrawtransaction is marked as DEPRECATED and will call the right signrawtransaction* command as per the parameters in order to maintain compatibility. Updated signrawtransactions test to use new RPCs
2018-02-16Revert "[tests] bind functional test nodes to 127.0.0.1"John Newbery
This reverts commit 65682da7e57af544abb46a7d8a7f4fdca0c73f56.
2018-02-15qa: Move common args to bitcoin.confMarcoFalke
2018-02-15Merge #12200: Bind functional test nodes to 127.0.0.1Wladimir J. van der Laan
65682da [tests] bind functional test nodes to 127.0.0.1 (Sjors Provoost) Pull request description: Prevents OSX firewall allow-this-application-to-accept-inbound-connections permission popups and is generally safer. To test, make an arbitrary whitespace change to `src/bitcoind.cpp` and recompile. This normally resets the firewall's memory. Easiest way to reproduce a popup without running the test suite: ```sh src/bitcoind -regtest -bind=127.0.0.1 # No popup src/bitcoind -regtest # Popup ``` Tree-SHA512: ffa92f148a2ead2ceca978c285882979639be23eb31ad6a27aa81df9fdddba5d493719c92c09a351a81d638f6f739c351a721e42168d77ead60abe074df773d6
2018-01-17qa: Sync with validationinterface queue in sync_mempoolsMarcoFalke
2018-01-16[tests] bind functional test nodes to 127.0.0.1Sjors Provoost
2018-01-03Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa
2017-10-05scripted-diff: rename assert_raises_jsonrpc to assert_raises_rpc errorJohn Newbery
-BEGIN VERIFY SCRIPT- sed -i 's/assert_raises_jsonrpc/assert_raises_rpc_error/g' test/functional/*py test/functional/test_framework/*py -END VERIFY SCRIPT-
2017-10-05[tests] do not allow assert_raises_message to be called with JSONRPCExceptionJohn Newbery
2017-10-05[tests] remove direct testing on JSONRPCException from individual test casesJohn Newbery
2017-09-29Merge #10552: [Test] Tests for zmqpubrawtx and zmqpubrawblockMarcoFalke
d3677ab75 Tests for zmqpubrawtx and zmqpubrawblock (Andrew Chow) Pull request description: Tree-SHA512: 9e367fd8936514bfb567ef3f3d83770d374287354b59c9187e844056dd086e8aa2de32ce55d35486cecd706e7c93cd1c1e2709ee82d3dddb805827be8d2bcb14
2017-09-18Tests for zmqpubrawtx and zmqpubrawblockAndrew Chow
2017-09-07[test] Add assert_raises_process_error to assert process errorsJoão Barbosa
2017-09-07[test] Improve assert_raises_jsonrpc docstringJoão Barbosa
2017-08-17qa: Move wait_until to utilMarcoFalke
2017-08-15[tests] Introduce TestNodeJohn Newbery
TestNode is a class responsible for all state related to a bitcoind node under test. It stores local state, is responsible for tracking the bitcoind process and delegates unrecognised messages to the RPC connection. This commit changes start_nodes and stop_nodes to start and stop the bitcoind nodes in parallel, making test setup and teardown much faster.
2017-07-06Fix multi_rpc test for hosts that dont default to utf8Matt Corallo
Otherwise the utf8 written to bitcoin.conf throws an exception when read from get_auth_cookie
2017-07-02[tests] nits in dbcrash.pyJohn Newbery
2017-06-29[tests] fix nits.John Newbery
Thanks to Marco Falke.
2017-06-29[tests] reorganize utils.py module (code move only)John Newbery
This commit re-organizes the utils.py module into logical sections.
2017-06-29[tests] move mocktime property and functions to BitcoinTestFrameworkJohn Newbery
2017-06-29[tests] Move stop_node and start_node methods to BitcoinTestFrameworkJohn Newbery
This commit moves functions start_node, start_nodes, stop_node and stop_nodes functions into the BitcoinTestFramework class. It also moves the bitcoind_processes dict and coverage variables into BitcoinTestFramework.
2017-06-29[tests] fix flake8 warnings in test_framework.py and util.pyJohn Newbery
2017-06-29[tests] remove unused imports from utils.pyJohn Newbery
2017-06-26[qa] Test non-atomic chainstate writesSuhas Daftuar
Adds new functional test, dbcrash.py, which uses -dbcrashratio to exercise the logic for recovering from a crash during chainstate flush. dbcrash.py is added to the extended tests, as it may take ~10 minutes to run Use _Exit() instead of exit() for crash simulation This eliminates stderr output such as: terminate called without an active exception or Assertion failed: (!pthread_mutex_destroy(&m)), function ~recursive_mutex, file /usr/local/include/boost/thread/pthread/recursive_mutex.hpp, line 104. Eliminating the stderr output on crash simulation allows testing with test_runner.py, which reports a test as failed if stderr is produced.
2017-06-22Merge #10636: [qa] util: Check return code after closing bitcoind procMarcoFalke
999923e [qa] util: Check return code after closing bitcoind proc (MarcoFalke) Tree-SHA512: 1aa911e5ce25ef59b006b7f8f25e5eef3c6c31f1b4362564e158ed92dd7804625fccc08be8b98c8c32779b530a8ec988819947692698214e34f5cb1d411c9eda