diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-11-04 11:06:59 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-11-04 13:21:54 +0100 |
commit | fa2ecadd0d3283a89d27772dc0275e76277ae17e (patch) | |
tree | 295f354c35e29489375ddc02068cd19f73186ad8 /test/functional | |
parent | 88776c2926061482ab551b0cf5c408fc1bc39ac3 (diff) |
test: Fix intermittent rpc_net issue
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/rpc_net.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py index 034827b2b8..2efd090733 100755 --- a/test/functional/rpc_net.py +++ b/test/functional/rpc_net.py @@ -21,7 +21,6 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_approx, assert_equal, - assert_greater_than_or_equal, assert_greater_than, assert_raises_rpc_error, p2p_port, @@ -114,10 +113,10 @@ class NetTest(BitcoinTestFramework): self.wait_until(lambda: (self.nodes[0].getnettotals()['totalbytessent'] >= net_totals_before['totalbytessent'] + 32 * 2), timeout=1) self.wait_until(lambda: (self.nodes[0].getnettotals()['totalbytesrecv'] >= net_totals_before['totalbytesrecv'] + 32 * 2), timeout=1) - peer_info_after = self.nodes[0].getpeerinfo() - for before, after in zip(peer_info_before, peer_info_after): - assert_greater_than_or_equal(after['bytesrecv_per_msg'].get('pong', 0), before['bytesrecv_per_msg'].get('pong', 0) + 32) - assert_greater_than_or_equal(after['bytessent_per_msg'].get('ping', 0), before['bytessent_per_msg'].get('ping', 0) + 32) + for peer_before in peer_info_before: + peer_after = lambda: next(p for p in self.nodes[0].getpeerinfo() if p['id'] == peer_before['id']) + self.wait_until(lambda: peer_after()['bytesrecv_per_msg'].get('pong', 0) >= peer_before['bytesrecv_per_msg'].get('pong', 0) + 32, timeout=1) + self.wait_until(lambda: peer_after()['bytessent_per_msg'].get('ping', 0) >= peer_before['bytessent_per_msg'].get('ping', 0) + 32, timeout=1) def test_getnetworkinfo(self): self.log.info("Test getnetworkinfo") |