Commit graph

9 commits

Author SHA1 Message Date
John Newbery e9e9391083 [tests] Check connectivity before sending in assumevalid.py
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.
2017-09-15 14:38:18 -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 6cf094a022 [tests] Avoid passing around member variables in test_framework 2017-09-01 12:25:54 -04:00
John Newbery 36b6268670 [tests] TestNode: separate add_node from start_node
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.
2017-09-01 12:25:54 -04:00
John Newbery d8c218f9c2 [tests] Functional tests call self.start_node(s) and self.stop_node(s)
This commit changes the individual test scripts to call the
start_node(s) and stop_node(s) methods in BitcoinTestFramework.
2017-05-31 16:59:38 -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 717ad131f6 Actually run assumevalid.py.
assumevalid was merged as part of PR 9484, but was not added to the
test_runner, so is not run even as part of the extended tests.

This commit adds assumevalid to the list of tests in test_runner. It
also clarifies the code in assumevalid considerably.
2017-03-24 18:23:36 -04:00
John Newbery c28ee91db0 Rename rpc-tests directory to functional 2017-03-20 10:40:31 -04:00
Renamed from test/rpc-tests/assumevalid.py (Browse further)