Commit graph

19 commits

Author SHA1 Message Date
John Newbery 34e08b3510 [tests] Fix network threading in functional tests
assumevalid.py, example_test.py and p2p-acceptblocks.py add
p2p_connections after the NetworkThread has been started. This isn't
permitted. Fix test to restart the network thread when adding new
connections.

p2p-leaktest.py had a potential race condition if the NetworkThread
hadn't terminated by the time we tried to restart it.
2017-12-11 09:17:21 -05:00
John Newbery 74e64f24b8 [tests] Use network_thread_start() in tests. 2017-12-11 09:17:21 -05:00
John Newbery 873beca6de [tests] Rename NodeConn and NodeConnCB
NodeConn -> P2PConnection
NodeConnCB -> P2PInterface
2017-11-29 17:14:48 -05:00
MarcoFalke faaa7db25e qa: Only allow disconnecting all NodeConns 2017-11-13 15:27:10 -05:00
John Newbery 32ae82f5c3 [tests] use TestNode p2p connection in tests 2017-11-08 09:32:04 -05:00
Matt Corallo 00dcda60f6 [qa] test that invalid blocks on an invalid chain get a disconnect 2017-10-31 13:51:34 -04:00
Matt Corallo 932f118e6a Accept unrequested blocks with work equal to our tip
This is a simple change that makes our accept requirements the
same as our request requirements, (ever so slightly) further
decoupling our consensus logic from our FindNextBlocksToDownload
logic in net_processing.
2017-10-31 13:36:06 -04:00
Matt Corallo 3b4ac43bc3 Rewrite p2p-acceptblock in preparation for slight behavior changes
Removes checking whitelisted behavior (which will be removed, the
difference in behavior here makes little sense) and no longer
requires that blocks at the same work as our tip be dropped if not
requested (in part because we *do* request those blocks).
2017-10-31 13:36:02 -04:00
Suhas Daftuar 08fd822771 qa: add test for minchainwork use in acceptblock 2017-10-19 20:38:22 -04:00
Wladimir J. van der Laan 6759a24eaa
Merge #11472: qa: Make tmpdir option an absolute path, misc cleanup
fafa003 qa: Remove never used return value of sync_with_ping (MarcoFalke)
fa9de37 qa: Make tmpdir option an absolute path (MarcoFalke)

Pull request description:

  This should fix issues with the multiwallet test and its symlinks
  when the tmpdir is a relative path.

  Rather than fixing os.symlink to work with paths relative to a
  directory descriptor, which does not work on Windows, normalize
  the path instead.

Tree-SHA512: 189690f3d065ea2f0f48e06775c86d513d0916c7c86312432e8e16df160e65539e288c2bd53d49a4180735fa940f6fcd52b506ccd7d9815651a9b1a69850dda6
2017-10-18 16:52:48 +02:00
MarcoFalke fafa003970 qa: Remove never used return value of sync_with_ping 2017-10-13 15:29:18 +02:00
John Newbery 47ba8cf71e scripted-diff: rename assert_raises_jsonrpc to assert_raises_rpc error
-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 09:57:19 -04:00
John Newbery 5448a1471d [tests] don't override __init__() in individual tests
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.
2017-09-01 12:25:55 -04:00
John Newbery c9cc76dcaa [tests] Remove is_network_split from funtional test cases 2017-05-02 13:31:54 -04:00
John Newbery 2a52ae63bf Remove duplicate method definitions in NodeConnCB subclasses
All Node classes in individual test cases subclass from NodeConnCB. Many
have duplicate definitions for methods that are defined in the base
class. This commit removes those duplicate definitions.

This commit removes ~290 lines of duplicate code.
2017-04-18 17:20:09 -04:00
John Newbery 52e15aa4d0 Adds helper functions to NodeConnCB
This commit adds some helper functions to NodeConnCB which are useful
for many tests:

- NodeConnCB now keeps track of the number of each message type that
it's received and the most recent message of each type. Many tests
assert on the most recent block, tx or reject message.
- NodeConnCB now keeps track of its connection state by setting a
connected boolean in on_open() and on_close()
- NodeConnCB now has wait_for_block, wait_for_getdata,
wait_for_getheaders, wait_for_inv and wait_for_verack methods

I have updated the individual test cases to make sure that there are no
namespace problems that cause them to fail with these new definitions.
Future commits will remove the duplicate code.
2017-04-18 15:25:01 -04:00
John Newbery 6a18bb9a36 [tests] sync_with_ping should assert that ping hasn't timed out
sync_with_ping currently returns false if the timeout expires, and it is
the caller's responsibility to fail the test. However, none of the tests
currently assert on sync_with_ping()'s return code. This commit adds an
assert to sync_with_ping so the test will fail if the timeout expires.

This commit also removes all the duplicate implementations of
sync_with_ping() from the individual tests.
2017-03-30 08:39:12 -04:00
John Newbery 159fe88abf Remove SingleNodeConnCB
This commit merges the NodeConnCB and SingleNodeConnCB into a single
class (called NodeConnCB). The original intent for the NodeConnCB was to
be able to have a python 'mininode' connect to multiple running
bitcoinds. This has never been used and can be achieved more easily by
having multiple NodeConns backed by a common datastore if it is ever
needed.

The changes in mininode.py are just code moves (and merging the two
classes into a single class). The code changes in the individual test
cases are changing the subclasses to subclass from NodeConnCB instead of
SingleNodeConnCB. There is a lot of duplicate code in the subclasses
that can be removed in future commits.
2017-03-28 14:16:21 -04:00
John Newbery c28ee91db0 Rename rpc-tests directory to functional 2017-03-20 10:40:31 -04:00
Renamed from test/rpc-tests/p2p-acceptblock.py (Browse further)