Commit graph

21 commits

Author SHA1 Message Date
MarcoFalke fafa003970 qa: Remove never used return value of sync_with_ping 2017-10-13 15:29:18 +02:00
MarcoFalke ff4cd6075b
Merge #11319: [qa] Fix error introduced into p2p-segwit.py, and prevent future similar errors
f97ab35fa qa: Fix bug introduced in p2p-segwit.py (Suhas Daftuar)
a7820422e qa: Treat mininode p2p exceptions as fatal (Suhas Daftuar)

Pull request description:

  #11121 inadvertently broke the constructor for the `TestNode()` object in `p2p-segwit.py`, silently breaking at least one of the tests.

  Although the python code was raising exceptions due to a `TestNode()` object not existing (or having the right type), mininode was masking these from anyone running the test through the test_runner (like travis), because it catches all exceptions during message delivery and just prints a log message and continues.  Such "graceful" handling of errors is almost certainly something we don't want in our test suite, so the first commit here attempts to prevent that type of failure from ever being masked.

  The second commit fixes the particular bug in `p2p-segwit.py`.

Tree-SHA512: b6646e3cb1e05c35c28e8899c44104bf2e2d0384643ca87042ab7f6ec0960d89f5bf25a7b95bab6e32d401c20a6018226160500f6ddceb923e81ffb04adb4f2f
2017-09-29 20:23:59 +02:00
MarcoFalke 4ce2f3d0d3
Merge #11323: mininode: add an optimistic write and disable nagle
1817398b3 mininode: add an optimistic write and disable nagle (Cory Fields)

Pull request description:

  Disclaimer: I'm not familiar with asyncore, so I'm unclear how safe this is. It works for me (tm).

  Because the poll/select loop may pause for 100msec before actually doing a send, and we have no way to force the loop awake, try sending from the calling thread if the queue is empty.

  Also, disable nagle as all sends should be either full messages or unfinished sends.

  This shaves an average of ~1 minute or so off of my accumulated runtime, and 10-15 seconds off of actual runtime.

Tree-SHA512: 6b61b8058e621dacf0b4dd353c10e3666fbda0691440eb6ebc432491ebada80a781dcd09291bf03e70112a41d3c2a0c91775ed08824b79bf8d0ebed11595c28b
2017-09-18 21:10:21 +02:00
Cory Fields 1817398b39 mininode: add an optimistic write and disable nagle
Because the poll/select loop may pause for 100msec before actually doing a
send, and we have no way to force the loop awake, try sending from the calling
thread if the queue is empty.

Also, disable nagle as all sends should be either full messages or unfinished
sends.

This shaves an average of ~1 minute or so off of my accumulated runtime, and
10-15 seconds off of actual runtime.
2017-09-13 13:31:44 -04:00
MarcoFalke 42973f8344
Merge #11078: [tests] Make p2p-leaktests.py more robust
0063d2c3d [tests] Make p2p-leaktests.py more robust (John Newbery)

Pull request description:

  There has been an example of p2p-leaktests.py failing on travis in the new service bits test (introduced in #11001 . It appeared to me that the previous p2p connections had not been fully disconnected before attempting to add new p2p connections.

  I've added a sleep and restarted the NetworkThread, but I don't know whether this will fix the problem, since I'm unable to reproduce the failure locally.

  @MarcoFalke - not sure what you want to do here? I don't think this change could make things any worse.

Tree-SHA512: f5427c26267185a903c9b75bb3925bf153b8afce70c8e493bf8f585f57d809d20643b4ee69081300b211d22e960242aecc3d719f4ddd230aa08fdc5484b55055
2017-09-13 18:54:50 +02:00
Suhas Daftuar a7820422e0 qa: Treat mininode p2p exceptions as fatal 2017-09-13 09:17:15 -04:00
practicalswift 2e6080bbf3 Remove unused variables and/or function calls 2017-08-28 15:18:14 +02:00
John Newbery 0063d2c3dc [tests] Make p2p-leaktests.py more robust 2017-08-24 17:28:13 -04:00
MarcoFalke 08ce33f8e9 qa: Move wait_until to util 2017-08-17 15:17:09 +02:00
John Newbery 5e35cd94c1 [tests] Test disconnecting unsupported service bits logic.
In v0.15, we disconnect nodes that send us version messages with
unsupported service bits (1 << 5 and 1 << 7). This commit adds a test
that bitcoind will disconnect those nodes before August 1st 2018, and won't
disconnect those nodes after August 1st 2018.
2017-08-07 11:37:54 -04:00
Dimitris Tsapakidis 0a5a6b90bc Fixed multiple typos
A few "a->an" and "an->a".
"Shows, if the supplied default SOCKS5 proxy" -> "Shows if the supplied default SOCKS5 proxy". Change made on 3 occurrences.
"without fully understanding the ramification of a command" -> "without fully understanding the ramifications of a command".
Removed duplicate words such as "the the".
2017-06-22 19:18:10 +03:00
John Newbery b0bfa233a1 [tests] Make wait_until timeout 60 seconds by default 2017-05-09 08:55:13 -04:00
John Newbery 3e3c22f09d [tests] fix wait_for_inv() 2017-05-03 09:08:29 -04:00
Wladimir J. van der Laan 8f3e38477e
Merge #10169: [tests] Remove func test code duplication
2a52ae6 Remove duplicate method definitions in NodeConnCB subclasses (John Newbery)
52e15aa Adds helper functions to NodeConnCB (John Newbery)

Tree-SHA512: 2d7909eb85b3bde0fc3ebf133798eca21e561f4b2a2880937750820a42856cfb61fc94e30591c14ac13218bcfae0ebe7c5e8662a7b10f5b02470325c44a86cf1
2017-05-02 19:11:55 +02:00
Jimmy Song c39a6b9ec8 Tests: Refactor to create witness script creation function
* Refactor blocktools.py so that witness script creation is its own function
* Changed p2p-segwit to use new function
2017-04-20 11:28:45 -07: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 45ce471ab0 Reduce spammy test logging
This commit reduces spammy logging by the test framework. It truncates
logging send/receive message in mininode to 500 characters.  mininode
was previously logging the entire message sent received, which can be up
to 1MB for a full block.
2017-04-07 22:16:41 -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/test_framework/mininode.py (Browse further)