Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Oct 3, 2017

This includes test related backports for 0.15.1. The motivation is twofold:

  • Make backporting new tests written for current master easier
  • Fix the most common test issues that happen(ed) frequently on travis

Even though this includes the new TestNode class, which comes with a lot
of refactoring, I believe that the issues caused by refactoring are found
and fixed by now.

jnewbery and others added 22 commits October 3, 2017 18:18
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.

Github-Pull: bitcoin#10711
Rebased-From: 7897338
When running the tests locally with a parallelism of 4 on an otherwise
busy system, RPC can take quite a wait to come up.

Change the timeout to 60 seconds just to be safe.

Github-Pull: bitcoin#11091
Rebased-From: c1470a0
Fixes a couple of bugs from the introduction of TestNode:

- test scripts were no longer able to specify a custom timeout for
starting a node. Therefore tests with nodes that take a long time to
start up (eg pruning.py) would fail.
- the test for whether a node has failed on start up was broken
by changing 'assert x is None' to 'assert not x'. Since
subprocess.poll() can return None (indicating the node is still running)
or 0 (indicating the node exited with return code 0), this was a
regression.

Github-Pull: bitcoin#11077
Rebased-From: 2b4ea52
Github-Pull: bitcoin#11068
Rebased-From: 08ce33f
Separates the act of creating a TestNode object from starting the node.
The test_framework now keeps track of its list of TestNodes, and test
writers can call start_node() and stop_node() without having to update
the self.nodes list.

Github-Pull: bitcoin#11121
Rebased-From: 36b6268
Almost all test scripts currently need to override the __init__()
method. When they do that they need to call into super().__init__() as
the base class does some generic initialization.

This commit makes the base class __init__() call into set_test_params()
method. Individual test cases can override set_test_params() to setup
their test parameters.

Github-Pull: bitcoin#11121
Rebased-From: 5448a14
This patch improves branch coverage of the test, making sure a
message can not be verified with the wrong address or signature.

Github-Pull: bitcoin#11241
Rebased-From: b3d6fc6
@maflcko maflcko force-pushed the Mf1710-0151qaBackports branch 2 times, most recently from 9c534ec to 86be17a Compare October 3, 2017 19:52
jnewbery and others added 6 commits October 3, 2017 22:03
assumevalid.py would try to send over a closed P2P connection in a loop,
hitting the following failure many times:

TestFramework.mininode (ERROR): Cannot send message. No connection to node!

The test still passes, but this is a lot of noise in the test log.

Just check that the connection is open before trying to send.

Github-Pull: bitcoin#11345
Rebased-From: e9e9391
Jim Posen and others added 7 commits October 3, 2017 22:03
Does not test watch-only addresses.

Github-Pull: bitcoin#11116
Rebased-From: 7a1e873
Changing __init__() -> set_test_params() in the tests should not have
applied to NodeConnCB-derived objects.

Github-Pull: bitcoin#11319
Rebased-From: f97ab35
The LevelDB docs seem to indicate that an iterator will not take
snapshots (even providing instructions on how to do so yourself).
In several of the places we use them, we assume snapshots to have
been taken.

In order to make sure LevelDB doesn't change out from under us
(and to prevent the next person who reads the docs from having the
same fright I did), verify that snapshots are taken in our tests.

Github-Pull: bitcoin#11422
Rebased-From: bb8376b
@maflcko maflcko force-pushed the Mf1710-0151qaBackports branch from 86be17a to 806c78f Compare October 3, 2017 20:03
@fanquake fanquake added the Tests label Oct 3, 2017
@fanquake fanquake added this to the 0.15.1 milestone Oct 3, 2017
@laanwj
Copy link
Member

laanwj commented Oct 4, 2017

utACK

@fanquake
Copy link
Member

fanquake commented Oct 6, 2017

utACK 019c492

@laanwj laanwj merged commit 019c492 into bitcoin:0.15 Oct 11, 2017
laanwj added a commit that referenced this pull request Oct 11, 2017
019c492 qa: Fix lcov for out-of-tree builds (MarcoFalke)
e169349 qa: Restore bitcoin-util-test py2 compatibility (MarcoFalke)
806c78f add functional test for mempoolreplacement command line arg (Gregory Sanders)
a825d4a Fix bip68-sequence rpc test (Johnson Lau)
a36f332 Verify DBWrapper iterators are taking snapshots (Matt Corallo)
8d2e51d qa: Fix bug introduced in p2p-segwit.py (Suhas Daftuar)
2f0b30a qa: Treat mininode p2p exceptions as fatal (Suhas Daftuar)
e4605d9 Tests for zmqpubrawtx and zmqpubrawblock (Andrew Chow)
2c4ff35 [script] Unit tests for IsMine (Jim Posen)
794a80e [script] Unit tests for script/standard functions (Jim Posen)
f9cf7b5 [tests] Check connectivity before sending in assumevalid.py (John Newbery)
f1ced0d [tests] Make p2p-leaktests.py more robust (John Newbery)
2e1ac70 [qa] zapwallettxes: Wait up to 3s for mempool reload (MarcoFalke)
b6468d3 Add listwallets RPC test to multiwallet.py (Cristian Mircea Messel)
d8dd8e7 [tests] fixup dbcrash interaction with add_nodes() (John Newbery)
2b97b36 [test] Replace check_output with low level version (João Barbosa)
e38211f [test] Add assert_raises_process_error to assert process errors (João Barbosa)
e0bfd28 [test] Add support for custom arguments to TestNodeCLI (João Barbosa)
812c870 [test] Improve assert_raises_jsonrpc docstring (João Barbosa)
eeb24a3 [qa] TestNode: Add wait_until_stopped helper method (MarcoFalke)
f3f7891 Stop test_bitcoin-qt touching ~/.bitcoin (MeshCollider)
f0b6795 Remove redundant testutil files (MeshCollider)
4424176 Improve signmessages functional test (Cristian Mircea Messel)
cef0319 [tests] fixups from set_test_params() (John Newbery)
82bf6fc [tests] Functional tests must explicitly set num_nodes (John Newbery)
801d2ae [tests] don't override __init__() in individual tests (John Newbery)
bb5e7cb [tests] Avoid passing around member variables in test_framework (John Newbery)
4d3ba18 [tests] TestNode: separate add_node from start_node (John Newbery)
11a5992 [tests] fix - use rpc_timeout as rpc timeout (John Newbery)
847c75e Add getmininginfo functional test (Cristian Mircea Messel)
2a5d099 RPC: gettxout: Slightly improve doc and tests (Jorge Timón)
716066d [tests] Add bitcoin_cli.py test script (John Newbery)
016b9ad [tests] add TestNodeCLI class for calling bitcoin-cli for a node (John Newbery)
5398f20 qa: Move wait_until to util (MarcoFalke)
1d80d1e [tests] fix timeout issues from TestNode (John Newbery)
c276c1e test: Increase initial RPC timeout to 60 seconds (Wladimir J. van der Laan)
fc2aa09 [tests] Introduce TestNode (John Newbery)

Pull request description:

  This includes test related backports for 0.15.1. The motivation is twofold:

  * Make backporting new tests written for current master easier
  * Fix the most common test issues that happen(ed) frequently on travis

  Even though this includes the new TestNode class, which comes with a lot
  of refactoring, I believe that the issues caused by refactoring are found
  and fixed by now.

Tree-SHA512: 6a0c4e5246da83ff0b3f7d2cb8df358d105ed548fb3857e5d882f26cc336553aa07b39e38c281879bf82f95078298b775334f9a60c0b23140f77c50174bd8347
UdjinM6 added a commit to dashpay/dash that referenced this pull request Sep 27, 2019
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.