Commit graph

32 commits

Author SHA1 Message Date
John Newbery
d055bd69cf Fix extended rpc tests broken by 8910b4717e 2017-03-10 15:50:38 -05:00
John Newbery
64c080051b Use logging in individual tests 2017-03-09 09:26:48 -05:00
John Newbery
b0dec4a04a Remove manual debug settings in qa tests.
-debug and -logtimemicros are now set by default. Individual test cases
no longer need to set these parameters manually.
2017-03-09 09:26:48 -05:00
John Newbery
c1190963b3 Return correct error codes in blockchain.cpp.
RPCs in blockchain.cpp were returning misleading or incorrect error
codes (for example getblock() returning RPC_INTERNAL_ERROR when the
block had been pruned). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
  errors, only for genuine internal errors such as corrupted data.
- RPC_METHOD_NOT_FOUND should not be returned in response to a
  JSON request for an existing method.

Those error codes have been replaced with RPC_MISC_ERROR or
RPC_INVALID_PARAMETER as appropriate.
2017-03-07 16:45:09 -05:00
Russell Yanofsky
e57a1fd899 Define 7200 second timestamp window constant 2017-03-03 13:51:41 -05:00
MarcoFalke
d6064a89ac
Merge #9577: Fix docstrings in qa tests
3f95a80 Fix docstrings in qa tests (John Newbery)
2017-02-23 16:39:22 +01:00
John Newbery
3f95a806b1 Fix docstrings in qa tests
This commit fixes the module-level docstrings for the tests and helper
modules in qa. Many of these tests were uncommented previously - this
commit ensures that every test case has at least a minimum level of
commenting.
2017-02-23 10:31:04 -05:00
Russell Yanofsky
874c7363d7 Fix pruning test broken by 2 hour manual prune window
Regression happened in 91fb506 Add two hour buffer to manual pruning.
2017-02-21 12:57:30 -05:00
MarcoFalke
fab035f2f7 qa: Actually test assertions in pruning.py
Also refactor to use wrapper for stop_node
2017-01-26 16:30:15 +01:00
MarcoFalke
f89502306d
Merge #9628: qa: Increase a sync_blocks timeout in pruning.py
2f10f06 qa: Increase a sync_blocks timeout in pruning.py (Suhas Daftuar)
2017-01-26 01:12:11 +01:00
Suhas Daftuar
2f10f06196 qa: Increase a sync_blocks timeout in pruning.py 2017-01-25 10:21:37 -05:00
Russell Yanofsky
918d1fb86b Return height of last block pruned by pruneblockchain RPC
Change suggested by Jonas Schnelli <dev@jonasschnelli.ch> in
https://github.com/bitcoin/bitcoin/pull/7871#discussion_r95577623
2017-01-11 14:25:32 -05:00
Russell Yanofsky
afffeea7d9 fixup! Add pruneblockchain RPC to enable manual block file pruning.
Extend pruneblockchain RPC to accept block timestamps as well as block indices.
2017-01-10 08:14:50 -05:00
mrbandrews
1fc4ec7bf2 Add pruneblockchain RPC to enable manual block file pruning. 2017-01-10 08:14:50 -05:00
MarcoFalke
fa2ecc48fb [qa] pruning: Use cached utxo set to run faster 2016-12-04 21:30:20 +01:00
MarcoFalke
facbfa5816 [qa] Get rid of duplicate code 2016-12-02 16:32:00 +01:00
Suhas Daftuar
a0f8482f3e [qa] Split up slow RPC calls to avoid pruning test timeouts 2016-09-28 11:08:08 -04:00
Suhas Daftuar
36f1b9df76 Tests: Increase sync_blocks() timeouts in pruning.py 2016-06-28 10:32:09 -04:00
MarcoFalke
8844ef15de
Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework
fad68f7 [qa] Reduce node count for some tests (MarcoFalke)
fac9349 [qa] Remove hardcoded "4 nodes" from test_framework (MarcoFalke)
2016-05-20 15:26:22 +02:00
MarcoFalke
fac9349798 [qa] Remove hardcoded "4 nodes" from test_framework 2016-05-15 12:58:53 +02:00
error10
ac40ed7800 Increase timeout waiting for pruned blk00000.dat
In my ever-growing list of test failures, I was seeing this one intermittently.

```
Running 2nd level testscript pruning.py...
Initializing test directory /tmp/testY5ypCv
Warning! This test requires 4GB of disk space and takes over 30 mins (up to 2 hours)
Mining a big blockchain of 995 blocks
Check that we haven't started pruning yet because we're below PruneAfterHeight
Success
Though we're already using more than 550MB, current usage: 587
Mining 25 more blocks should cause the first block file to be pruned
Assertion failed: blk00000.dat not pruned when it should be
  File "/home/error/bitcoinxt-0.11D/qa/rpc-tests/test_framework/test_framework.py", line 118, in main
    self.run_test()
  File "/home/error/bitcoinxt-0.11D/qa/rpc-tests/pruning.py", line 272, in run_test
    self.test_height_min()
  File "/home/error/bitcoinxt-0.11D/qa/rpc-tests/pruning.py", line 94, in test_height_min
    raise AssertionError("blk00000.dat not pruned when it should be")
Stopping nodes
Failed
```

After digging into the test, I found that the code is waiting 10 seconds for blk00000.dat to be deleted, and then throwing this failure if it still exists after 10 seconds.

I increased this amount, had the script print the actual time taken, and ran the test a few more times. The time taken ranged between 8 to 12 seconds. So, I feel that this timeout is too short.

After changing the timeout to 30 seconds, the test passes consistently.
(cherry picked from commit 3469911c89a48dd2fefe4d1c2a0c176256e14ee0)
2016-05-10 17:49:12 +02:00
MarcoFalke
fa389d4edc [qa] Switch to py3 2016-05-05 15:43:37 +02:00
MarcoFalke
faa41ee204 [qa] py2: Unfiddle strings into bytes explicitly 2016-04-10 20:35:57 +02:00
MarcoFalke
fa2cea163b [qa] rpc-tests: Properly use integers, floats 2016-04-01 21:23:30 +02:00
MarcoFalke
7777994846 [qa] Fix pyton syntax in rpc tests 2016-01-13 20:31:03 +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
MarcoFalke
fa0a9749eb [qa] Move gen_return_txouts() to util.py 2015-12-24 12:26:36 +01:00
MarcoFalke
fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Alex Morcos
b6d5e32e0e Make fee aware of min relay in pruning.py RPC test 2015-10-17 15:52:40 -04:00
Jonas Schnelli
64937fe51a [QA] restructure rpc tests directory
* move non-test classes to subdir `test-framework`
2015-05-18 15:25:45 +02:00
Alex Morcos
8f0947be34 Increase timeouts in pruning.py and modify warning language. 2015-05-13 15:02:36 -04:00
mrbandrews
f9ec3f0fad Add block pruning functionality
This adds a -prune=N option to bitcoind, which if set to N>0 will enable block
file pruning. When pruning is enabled, block and undo files will be deleted to
try to keep total space used by those files to below the prune target (N, in
MB) specified by the user, subject to some constraints:

- The last 288 blocks on the main chain are always kept (MIN_BLOCKS_TO_KEEP),
- N must be at least 550MB (chosen as a value for the target that could
  reasonably be met, with some assumptions about block sizes, orphan rates,
  etc; see comment in main.h),
- No blocks are pruned until chainActive is at least 100,000 blocks long (on
  mainnet; defined separately for mainnet, testnet, and regtest in chainparams
  as nPruneAfterHeight).

This unsets NODE_NETWORK if pruning is enabled.

Also included is an RPC test for pruning (pruning.py).

Thanks to @rdponticelli for earlier work on this feature; this is based in
part off that work.
2015-04-22 15:53:48 -04:00