aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2018-02-20 21:25:02 -0800
committerMarcoFalke <falke.marco@gmail.com>2018-04-20 18:38:41 -0400
commit1286f3e49a7bdae72ae022ff4f83d0a77e832891 (patch)
tree83f79f41e60be3287fbb41f113f24b6295b28355 /test
parentcfebd400ef4b26f5b6c1d8b31c6f5e0f09184dba (diff)
downloadbitcoin-1286f3e49a7bdae72ae022ff4f83d0a77e832891.tar.xz
test: Use wait_until to ensure ping goes out
Intermittent failure evident here: https://travis-ci.org/bitcoin/bitcoin/jobs/344021180 Github-Pull: #12545 Rebased-From: 0eb84f30d80847b7392ad42b2d916eaf5923a63c
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_net.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py
index 16e4f6adb4..5f34b35bfb 100755
--- a/test/functional/rpc_net.py
+++ b/test/functional/rpc_net.py
@@ -15,6 +15,7 @@ from test_framework.util import (
assert_raises_rpc_error,
connect_nodes_bi,
p2p_port,
+ wait_until,
)
class NetTest(BitcoinTestFramework):
@@ -47,14 +48,13 @@ class NetTest(BitcoinTestFramework):
# the bytes sent/received should change
# note ping and pong are 32 bytes each
self.nodes[0].ping()
- time.sleep(0.1)
+ wait_until(lambda: (net_totals['totalbytessent'] + 32*2) == self.nodes[0].getnettotals()['totalbytessent'], timeout=1)
+ wait_until(lambda: (net_totals['totalbytesrecv'] + 32*2) == self.nodes[0].getnettotals()['totalbytesrecv'], timeout=1)
+
peer_info_after_ping = self.nodes[0].getpeerinfo()
- net_totals_after_ping = self.nodes[0].getnettotals()
for before, after in zip(peer_info, peer_info_after_ping):
assert_equal(before['bytesrecv_per_msg']['pong'] + 32, after['bytesrecv_per_msg']['pong'])
assert_equal(before['bytessent_per_msg']['ping'] + 32, after['bytessent_per_msg']['ping'])
- assert_equal(net_totals['totalbytesrecv'] + 32*2, net_totals_after_ping['totalbytesrecv'])
- assert_equal(net_totals['totalbytessent'] + 32*2, net_totals_after_ping['totalbytessent'])
def _test_getnetworkinginfo(self):
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)