Commit Graph

173 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 0572acd63b
Merge #8839: test: Avoid ConnectionResetErrors during RPC tests
1d28faf test: Avoid ConnectionResetErrors during RPC tests (Wladimir J. van der Laan)
2016-09-30 12:35:21 +02:00
Wladimir J. van der Laan 30930e847e test: Explicitly set encoding to utf8 when opening text files
These are text files but their encoding does not depend on the locale.
Not all of them require utf8 but it is better to fix it at something
to remove potential unpredictability.

This is necessary on FreeBSD where no locale is set by default,
and apparently Python defaults not only the terminal encoding to the locale
but that of every text file. So without LOCALE environment it defaults text
file encoding to ASCII. This causes problems with e.g. `bitcoin.conf`.

Luckily the locale doesn't affect the default encoding for str.encode() and
bytes.decode() on Python 3, so this is the only change necessary.
2016-09-29 17:50:05 +02:00
Wladimir J. van der Laan 1d28faf9e9 test: Avoid ConnectionResetErrors during RPC tests
This is necessary on FreeBSD and MacOSX, at least.

See https://github.com/bitcoin/bitcoin/pull/8834#issuecomment-250450213
2016-09-29 15:02:08 +00:00
MarcoFalke fa9cd25ed0 [qa] blockstore: Switch to dumb dbm 2016-09-29 11:18:31 +02:00
Wladimir J. van der Laan 42f6aed731 tests: Add exception error message for JSONRPCException
This improves error reporting if `JSONRPCException` is not specifically caught
and ends up in Python's default backtrace handler.

Before:
```
Traceback (most recent call last):
  File "/.../projects/bitcoin/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 153, in __call__
    raise JSONRPCException(response['error'])
test_framework.authproxy.JSONRPCException
```

After:
```
Traceback (most recent call last):
  File "/.../projects/bitcoin/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 152, in __call__
    raise JSONRPCException(response['error'])
test_framework.authproxy.JSONRPCException: Unknown named parameter random (-8)
```
2016-09-25 20:05:03 +02:00
Wladimir J. van der Laan d8b4b631c5
Merge #8676: Add missing copyright headers
783e930 [copyright] Add missing copyright headers (isle2983)
2016-09-19 19:13:48 +02:00
MarcoFalke 7fe6c5c993
Merge #8652: [qa]: remove root test directory for RPC tests
c62cc4e fix path for bak file (whythat)
438e94d remove root test directory for RPC tests (whythat)
2016-09-13 12:00:15 +02:00
isle2983 783e930e68 [copyright] Add missing copyright headers 2016-09-11 15:25:51 -06:00
MarcoFalke 2a0836f6d5
Merge #8667: Fix SIGHASH_SINGLE bug in test_framework SignatureHash
2f2548d Fix SIGHASH_SINGLE bug in test_framework SignatureHash (Johnson Lau)
2016-09-09 23:20:21 +02:00
Cory Fields d6a5dc4a2e add waitfornewblock/waitforblock/waitforblockheight rpcs and use them for tests
waitfornewblock waits until a new block is received, or the timeout expires, then
returns the current block height/hash.

waitforblock waits for a specific blockhash, or until the timeout expires, then
returns the current block height/hash. If the target blockhash is the current
tip, it will return immediately.

waitforblockheight waits until the tip has reached a certain height or higher,
then returns the current height and hash.

waitforblockheight is used to avoid polling in the rpc tests.
2016-09-07 12:46:01 -04:00
Johnson Lau 2f2548d5e0 Fix SIGHASH_SINGLE bug in test_framework SignatureHash
The value for "other" inputs should be -1 (0xffffffffffffffff) instead of 0
2016-09-06 00:50:23 +08:00
whythat 438e94dc33 remove root test directory for RPC tests 2016-09-05 02:00:43 +03:00
Pieter Wuille 5805ac836c Add preciousblock tests
Rebased, improved and extended by Luke-Jr.
2016-08-26 23:06:09 +02:00
Wladimir J. van der Laan 35f64e45c2
Revert "[qa] Adjust timeouts for micro-optimization of run time"
This reverts commit fa2d68f79c.

Temporary revert - see discussion in #8532.
2016-08-18 09:23:31 +02:00
Wladimir J. van der Laan 740cff5808
Merge #8482: [qa] Use single cache dir for chains
fad8cf6 [qa] Use single cache dir for chains (MarcoFalke)
fa2d68f [qa] Adjust timeouts for micro-optimization of run time (MarcoFalke)
fae596f [qa] Sort scripts by time for pull_tester and don't overwrite setup_chain (MarcoFalke)
2016-08-17 12:23:45 +02:00
MarcoFalke fad8cf63e5 [qa] Use single cache dir for chains 2016-08-07 23:13:22 +02:00
MarcoFalke fa2d68f79c [qa] Adjust timeouts for micro-optimization of run time 2016-08-07 23:13:08 +02:00
Wladimir J. van der Laan 63c03dd41c
Merge #8418: Add tests for compact blocks
45c7ddd Add p2p test for BIP 152 (compact blocks) (Suhas Daftuar)
9a22a6c Add support for compactblocks to mininode (Suhas Daftuar)
a8689fd Tests: refactor compact size serialization in mininode (Suhas Daftuar)
9c8593d Implement SipHash in Python (Pieter Wuille)
56c87e9 Allow changing BIP9 parameters on regtest (Suhas Daftuar)
2016-08-02 08:26:57 +02:00
Suhas Daftuar 9a22a6c089 Add support for compactblocks to mininode 2016-07-29 09:41:58 -04:00
Suhas Daftuar a8689fdf8e Tests: refactor compact size serialization in mininode 2016-07-29 09:41:58 -04:00
Pieter Wuille 9c8593d2b4 Implement SipHash in Python 2016-07-29 09:41:58 -04:00
whythat 0ff4375c93 [qa]: add parsing for '<host>:<port>' argument form to rpc_url() 2016-07-25 01:30:28 +03:00
Wladimir J. van der Laan 4324bd237c
Merge #8311: Rename CTxinWitness -> CTxInWitness
36ae37a Rename CTxinWitness -> CTxInWitness (Bob McElrath)
2016-07-14 08:18:38 +02:00
Wladimir J. van der Laan ff46dd4a34
Merge #7540: Rename OP_NOP3 to OP_CHECKSEQUENCEVERIFY
18c975c Rename NOP3 to CHECSEQUENCEVERIFY in rpc tests (BtcDrak)
14d0130 Rename OP_NOP3 to OP_CHECKSEQUENCEVERIFY (BtcDrak)
2016-07-08 11:39:10 +02:00
MarcoFalke fa9976b853 [qa] test_framework: Add wrapper for stop_node 2016-07-07 10:28:42 +02:00
Bob McElrath 36ae37a9f9 Rename CTxinWitness -> CTxInWitness 2016-07-06 19:46:46 -04:00
BtcDrak 14d01309be Rename OP_NOP3 to OP_CHECKSEQUENCEVERIFY 2016-06-28 17:17:36 +01:00
Suhas Daftuar 330b0f31ee [qa] p2p segwit tests
mininode now supports witness transactions/blocks, blocktools
has a helper for adding witness commitments to blocks, and script
has a function to calculate hashes for signature under sigversion
1, used by segwit.

Py3 conversion by Marco Falke

Test to make sure upgraded nodes don't ask for non-wit blocks by
Gregory Sanders.
2016-06-22 15:43:02 +02:00
Wladimir J. van der Laan 65c2058cc8
Merge #8066: [qa] test_framework: Use different rpc_auth_pair for each node
fad1845 [qa] test_framework: Use different rpc_auth_pair for each node (MarcoFalke)
2016-06-20 13:41:11 +02:00
MarcoFalke facb6c0bf8 [qa] mininode: fail on send_message instead of silent return 2016-06-17 13:31:31 +02:00
Wladimir J. van der Laan 9c3d0fab36
Merge #7892: Add full UTF-8 support to RPC
7982fce doc: Mention full UTF-8 support in release notes (Wladimir J. van der Laan)
6bbb4ef test: test utf-8 for labels in wallet (Wladimir J. van der Laan)
a406fcb test: add ensure_ascii setting to AuthServiceProxy (Wladimir J. van der Laan)
60ab9b2 Squashed 'src/univalue/' changes from 2740c4f..f32df99 (Wladimir J. van der Laan)
2016-06-16 12:08:35 +02:00
MarcoFalke fa26c420bf [qa] util: Move check_fee_amount out of wallet.py 2016-06-13 21:34:41 +02:00
Wladimir J. van der Laan 44c1b1c9bb
Merge #8141: Continuing port of java comparison tool
ff2dcf2 Tests: Edit bloated varint test and add option for 'barely expensive' tests (mrbandrews)
12c5a16 Catch exceptions from non-canonical encoding and print only to log (mrbandrews)
291f8aa Continuing port of java comptool (mrbandrews)
8c9e681 Tests: Rework blockstore to avoid re-serialization. (mrbandrews)
2016-06-13 11:37:37 +02:00
Wladimir J. van der Laan a406fcb6ca test: add ensure_ascii setting to AuthServiceProxy
Add a setting ensure_ascii to AuthServiceProxy. This setting,
defaulting to True (backwards compatible),
is passed through to json.dumps. If set to False, non-ASCII characters
>0x80 are not escaped. This is useful for testing server
input processing, as well as slightly more bandwidth friendly in case of
heavy unicode usage.
2016-06-10 15:20:49 +02:00
mrbandrews 291f8aa5da Continuing port of java comptool 2016-06-02 14:42:09 -04:00
Pieter Wuille f45f51e3ae Fix interrupted HTTP RPC connection workaround for Python 3.5+ 2016-06-02 19:17:04 +02:00
mrbandrews 8c9e681ff8 Tests: Rework blockstore to avoid re-serialization. 2016-05-31 14:21:40 -04:00
MarcoFalke 6ff2c8d29f
Merge #8104: Tests: add timeout to sync_blocks() and sync_mempools()
e871f83 Tests: add timeout to sync_blocks() and sync_mempools() (Suhas Daftuar)
2016-05-29 19:18:55 +02:00
MarcoFalke 06bd4f637f
Merge #8098: [qa] test_framework: Append portseed to tmpdir
fa57b0c [qa] test_framework: Append portseed to tmpdir (MarcoFalke)
2016-05-27 08:22:09 +02:00
Suhas Daftuar e871f8338a Tests: add timeout to sync_blocks() and sync_mempools()
Previously these functions would infinitely loop if sync failed;
now they have a default timeout of 60 seconds, after which an
AssertionError is raised.

sync_blocks() has also been improved and now compares the tip
hash of each node, rather than just using block count.
2016-05-26 14:19:07 -04:00
Suhas Daftuar 1ad9339508 Test framework: only cleanup on successful test runs 2016-05-25 05:43:50 -04:00
MarcoFalke 37f9a1f627
Merge #8047: [qa] test_framework: Set wait-timeout for bitcoind procs
fab5233 [qa] test_framework: Set wait-timeout for bitcoind procs (MarcoFalke)
2016-05-20 17:34:11 +02:00
MarcoFalke fa57b0c5ef [qa] test_framework: Append portseed to tmpdir
This makes it possible to specify a tmpdir while running tests in
parallel
2016-05-20 09:18:41 +02:00
MarcoFalke fad184550e [qa] test_framework: Use different rpc_auth_pair for each node 2016-05-17 11:02:13 +02:00
MarcoFalke fac9349798 [qa] Remove hardcoded "4 nodes" from test_framework 2016-05-15 12:58:53 +02:00
MarcoFalke fab5233fe6 [qa] test_framework: Set wait-timeout for bitcoind procs 2016-05-12 13:11:20 +02:00
MarcoFalke ccccc591a4 [qa] Add option --portseed to test_framework 2016-05-09 19:56:24 +02:00
MarcoFalke 4e14afe42f
Merge #7971: [qa] Refactor test_framework and pull tester
fad3366 [qa] pull-tester: Adjust comment (MarcoFalke)
fafb33c [qa] Stop other nodes, even when one fails to stop (MarcoFalke)
2222dae [qa] Update README.md (MarcoFalke)
fabbf6b [qa] Refactor test_framework and pull tester (MarcoFalke)
2016-05-09 17:06:44 +02:00
Jonas Schnelli 5ea450834e
Autofind rpc tests --srcdir 2016-05-09 15:05:58 +02:00
MarcoFalke fafb33cdef [qa] Stop other nodes, even when one fails to stop 2016-05-06 12:44:03 +02:00
MarcoFalke fabbf6bd62 [qa] Refactor test_framework and pull tester
* log to stdout
* increase range for p2p and rpc ports
* UPPERCASE_CONSTANTS
* Stop nodes on CTRL+C
2016-05-06 12:43:34 +02:00
MarcoFalke fa389d4edc [qa] Switch to py3 2016-05-05 15:43:37 +02:00
MarcoFalke fada064f67 [qa] test_framework: Properly print exceptions and assert empty dict 2016-04-26 18:04:26 +02:00
MarcoFalke 5555528b47 [qa] mininode: Unfiddle strings into bytes 2016-04-23 20:20:46 +02:00
Suhas Daftuar 807fa47a1e Tests: Fix deserialization of reject messages
Assume that reject messages for blocks or transactions due to reason
REJECT_MALFORMED will not include the hash of the block or tx being rejected.
2016-04-20 09:27:26 -04:00
Joao Fonseca fa942c755a Move method to check matches within arrays on util.py 2016-04-19 12:29:19 +01:00
Wladimir J. van der Laan b1bf511af6
Merge #7833: tests: Check Content-Type header returned from RPC server
5078ca4 tests: Check Content-Type header returned from RPC server (Wladimir J. van der Laan)
2016-04-18 12:45:04 +02:00
Wladimir J. van der Laan 6ef5e000a2
Merge #7853: [qa] py2: Unfiddle strings into bytes explicitly
faa41ee [qa] py2: Unfiddle strings into bytes explicitly (MarcoFalke)
2016-04-14 17:40:31 +02:00
Rusty Russell d12760b16a rpc-tests: handle KeyError nicely in test_framework.py
btcdrak wrote this for me.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-13 16:54:07 +09:30
Rusty Russell 85c807c9ea getblockchaininfo: make bip9_softforks an object, not an array.
We can't change "softforks", but it seems far more logical to use tags
in an object rather than using an "id" field in an array.

For example, to get the csv status before, you need to iterate the
array to find the entry with 'id' field equal to "csv":

   jq '.bip9_softforks | map(select(.id == "csv"))[] | .status'

Now:
   jq '.bip9_softforks.csv.status'

There is no issue with fork names being incompatible with JSON tags,
since we're selecting them ourselves.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-13 16:53:52 +09:30
MarcoFalke faa41ee204 [qa] py2: Unfiddle strings into bytes explicitly 2016-04-10 20:35:57 +02:00
Suhas Daftuar 5cb1d8a207 Tests: move get_bip9_status to util.py 2016-04-07 14:54:50 -04:00
Wladimir J. van der Laan 5078ca4543 tests: Check Content-Type header returned from RPC server
Check the Content-Type header that is returned from the RPC server. Only
if it is `application/json` the data is supposed to be parsed as JSON.

This gives better reporting if the HTTP server happens to return an error that is
not JSON-formatted, which is the case if it happens at a lower level
before JSON-RPC kicks in.

Before: `Unexpected exception caught during testing: No JSON object could be decoded`

After: `JSONRPC error: non-JSON HTTP response with '403 Forbidden' from server`
2016-04-07 15:40:17 +02:00
Wladimir J. van der Laan ff5874bcf7
Merge #7778: [qa] Bug fixes and refactor
4444806 [qa] mininode: Combine struct.pack format strings (MarcoFalke)
faaa3c9 [qa] mininode: Catch exceptions in got_data (MarcoFalke)
fa2cea1 [qa] rpc-tests: Properly use integers, floats (MarcoFalke)
fa524d9 [qa] Use python2/3 syntax (MarcoFalke)
2016-04-03 15:54:35 +02:00
MarcoFalke 444480649f [qa] mininode: Combine struct.pack format strings 2016-04-02 11:48:07 +02:00
MarcoFalke faaa3c9b65 [qa] mininode: Catch exceptions in got_data 2016-04-01 21:23:49 +02:00
MarcoFalke fa2cea163b [qa] rpc-tests: Properly use integers, floats 2016-04-01 21:23:30 +02:00
Wladimir J. van der Laan e9723cb273
Merge #7489: tests: Make proxy_test work on travis servers without IPv6
7539f1a tests: Make proxy_test work on travis servers without IPv6 (Wladimir J. van der Laan)
2016-04-01 14:42:26 +02:00
MarcoFalke fa524d9ddb [qa] Use python2/3 syntax 2016-03-31 18:35:17 +02:00
Wladimir J. van der Laan e8a8f3d4b2
Merge #7648: BIP9 versionbits softfork for BIP68, BIP112 and BIP113
71527a0 Test of BIP9 fork activation of mtp, csv, sequence_lock (NicolasDorier)
19d73d5 Add RPC test for BIP 68/112/113 soft fork. (Alex Morcos)
12c89c9 Policy: allow transaction version 2 relay policy. (BtcDrak)
02c2435 Soft fork logic for BIP68 (BtcDrak)
478fba6 Soft fork logic for BIP113 (BtcDrak)
65751a3 Add CHECKSEQUENCEVERIFY softfork through BIP9 (Pieter Wuille)
2016-03-30 18:59:39 +02:00
Wladimir J. van der Laan d8e862a5a7
Merge #7744: test_framework: detect failure of bitcoind startup
018b60c test_framework: detect failure of bitcoind startup (Wladimir J. van der Laan)
2016-03-29 17:16:30 +02:00
Luke Dashjr e7e48ba66c test_framework: Py3.4 compat: Specify timeout parameter by name
Changed in version 3.4: The strict parameter was removed. HTTP 0.9-style
“Simple Responses” are not longer supported.
(https://docs.python.org/3/library/http.client.html)

Source: 7ebeebb4f6
2016-03-28 12:30:48 +02:00
Wladimir J. van der Laan d7b80b54fb test_framework: Avoid infinite loop in encoding Decimal
Avoid an infinite loop in encoding, by ensuring EncodeDecimal
returns a string. round(Decimal) used to convert it to
float, but it no longer does in python 3.x. Strings are
supported since #6380, so just use that.
2016-03-28 12:20:13 +02:00
Wladimir J. van der Laan 018b60c5ea test_framework: detect failure of bitcoind startup
Replace the `bitcoin-cli -rpcwait` after spawning bitcoind
with our own loop that detects when bitcoind exits prematurely.

And if one node fails to start, stop the others.

This prevents a hang in such a case (see #7463).
2016-03-26 08:10:07 +01:00
Alex Morcos b536a6fc83 Add p2p test for feefilter 2016-03-21 10:46:25 -04:00
Alex Morcos 5fa66e4682 Create SingleNodeConnCB class for RPC tests 2016-03-21 10:46:25 -04:00
NicolasDorier 71527a0f31 Test of BIP9 fork activation of mtp, csv, sequence_lock 2016-03-21 09:07:34 +00:00
Suhas Daftuar ec143391ef Tests: make prioritise_transaction.py more robust 2016-03-16 12:52:04 -04:00
MarcoFalke fad8cfb893 [qa] mininode: Add and use CONSTs 2016-03-14 16:45:18 +01:00
MarcoFalke fa8cd46f39 [qa] Move create_tx() to util.py 2016-03-14 16:45:04 +01:00
Wladimir J. van der Laan 80d1f2e483
Merge #7184: Implement SequenceLocks functions for BIP 68
b043c4b fix sdaftuar's nits again (Alex Morcos)
a51c79b Bug fix to RPC test (Alex Morcos)
da6ad5f Add RPC test exercising BIP68 (mempool only) (Suhas Daftuar)
c6c2f0f Implement SequenceLocks functions (Alex Morcos)
2016-02-12 17:03:46 +01:00
Suhas Daftuar da6ad5f684 Add RPC test exercising BIP68 (mempool only) 2016-02-10 15:35:33 -05:00
Wladimir J. van der Laan 7539f1aae3 tests: Make proxy_test work on travis servers without IPv6 2016-02-09 12:37:05 +01:00
mrbandrews 7689041c03 [rpc-tests] Change solve() to use rehash 2016-02-04 14:36:11 -05:00
Wladimir J. van der Laan 9189e30b12
Merge #7300: [trivial] Add missing copyright headers
fabcee1 Remove copyright header from autogenerated chainparamsseeds.h (MarcoFalke)
fa60d05 Add missing copyright headers (MarcoFalke)
fa7e4c0 Bump copyright headers to 2014 (MarcoFalke)
2016-01-27 12:06:31 +01:00
MarcoFalke fa8e2a6925 [qa] Change default block priority size to 0 2016-01-20 16:58:43 +01:00
Wladimir J. van der Laan 3b43cad9d0
Merge pull request #7164: Do not download transactions during initial blockchain sync
39a525c Do not download transactions during inital sync (ptschip)
2016-01-19 12:58:15 +01:00
Wladimir J. van der Laan e4e77ee55d
Merge pull request #7194
135d6ec Add RPC tests for getblockheader. (James O'Beirne)
4745636 Add RPC documentation for getblockheader[chainwork]. (James O'Beirne)
16d4fce Add assert_is_hex_string and assert_is_hash_string to RPC test utils. (James O'Beirne)
2016-01-18 12:24:01 +01:00
MarcoFalke 7777994846 [qa] Fix pyton syntax in rpc tests 2016-01-13 20:31:03 +01:00
Suhas Daftuar 82a0ce09b4 Add race-condition debugging tool to mininode 2016-01-07 09:22:20 -05:00
MarcoFalke fa60d05a4e Add missing copyright headers 2016-01-05 21:34:15 +01:00
Wladimir J. van der Laan 605c17844e
Merge pull request #7205
fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke)
fa24439 Bump copyright headers to 2015 (MarcoFalke)
fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
2016-01-05 14:11:40 +01:00
Wladimir J. van der Laan 49a735cba4
Merge pull request #7250
fa0a974 [qa] Move gen_return_txouts() to util.py (MarcoFalke)
2016-01-04 11:58:12 +01:00
MarcoFalke fa0a9749eb [qa] Move gen_return_txouts() to util.py 2015-12-24 12:26:36 +01:00
Wladimir J. van der Laan 97d83739db
Merge pull request #7153
7632cf6 [Tests] Refactor some shared functions (Jonas Schnelli)
110ff11 [Tests] Add mempool_limit.py test (Jonas Schnelli)
2015-12-22 14:06:50 +01:00
Wladimir J. van der Laan 595f93977c
Merge pull request #7213
37d271d Rename OP_NOP2 to OP_CHECKLOCKTIMEVERIFY. (mb300sd)
2015-12-22 11:37:11 +01:00
Suhas Daftuar 9b41a5fba2 Add more tests to p2p-fullblocktest 2015-12-18 05:39:31 -05:00
ptschip 39a525c21f Do not download transactions during inital sync 2015-12-15 07:41:44 -08:00
mb300sd 37d271d7cc Rename OP_NOP2 to OP_CHECKLOCKTIMEVERIFY. 2015-12-15 02:01:45 -05:00
James O'Beirne 16d4fce0b2 Add assert_is_hex_string and assert_is_hash_string to RPC test utils. 2015-12-14 10:40:11 -08:00