aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p-leaktests.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-08-17 11:35:45 -0400
committerJohn Newbery <john@johnnewbery.com>2017-08-24 17:28:13 -0400
commit0063d2c3dce9d9c1678197d2c65ee878793d1ef9 (patch)
tree9b3abe39b7865b95e15b07c0f790399ccc55a189 /test/functional/p2p-leaktests.py
parent4ae6d0fbef60ccbecf8f23bb482e201b3678f7a3 (diff)
[tests] Make p2p-leaktests.py more robust
Diffstat (limited to 'test/functional/p2p-leaktests.py')
-rwxr-xr-xtest/functional/p2p-leaktests.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/functional/p2p-leaktests.py b/test/functional/p2p-leaktests.py
index f0d4d9a8b8..26f6f86aff 100755
--- a/test/functional/p2p-leaktests.py
+++ b/test/functional/p2p-leaktests.py
@@ -140,6 +140,9 @@ class P2PLeakTest(BitcoinTestFramework):
[conn.disconnect_node() for conn in connections]
+ # Wait until all connections are closed
+ wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 0)
+
# Make sure no unexpected messages came in
assert(no_version_bannode.unexpected_msg == False)
assert(no_version_idlenode.unexpected_msg == False)
@@ -158,8 +161,10 @@ class P2PLeakTest(BitcoinTestFramework):
allowed_service_bit5_node.add_connection(connections[5])
allowed_service_bit7_node.add_connection(connections[6])
- wait_until(lambda: allowed_service_bit5_node.message_count["verack"], timeout=10, lock=mininode_lock)
- wait_until(lambda: allowed_service_bit7_node.message_count["verack"], timeout=10, lock=mininode_lock)
+ NetworkThread().start() # Network thread stopped when all previous NodeConnCBs disconnected. Restart it
+
+ wait_until(lambda: allowed_service_bit5_node.message_count["verack"], lock=mininode_lock)
+ wait_until(lambda: allowed_service_bit7_node.message_count["verack"], lock=mininode_lock)
if __name__ == '__main__':
P2PLeakTest().main()