aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2018-12-31 13:30:18 -0800
committerBen Woosley <ben.woosley@gmail.com>2019-01-01 13:12:41 -0800
commitde23739b22fefd7a409f6cb0a4d6128c176fa229 (patch)
tree7efe65a4db3d0bcc989d2a047037c6314c980751 /test
parentf5a70d1462592a23bbad4aa150e6b2beaeec7c42 (diff)
downloadbitcoin-de23739b22fefd7a409f6cb0a4d6128c176fa229.tar.xz
test: Fix rpc_net.py "pong" race condition
Prior to this change, the test fails with KeyError if pong has a zero value at the time this is called, as getpeerinfo's bytesrecv_per_msg result excludes zero-values. https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21310881#L62
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_net.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py
index 0affddcf05..b12eb1d9ec 100755
--- a/test/functional/rpc_net.py
+++ b/test/functional/rpc_net.py
@@ -67,8 +67,8 @@ class NetTest(BitcoinTestFramework):
peer_info_after_ping = self.nodes[0].getpeerinfo()
for before, after in zip(peer_info, peer_info_after_ping):
- assert_greater_than_or_equal(after['bytesrecv_per_msg']['pong'], before['bytesrecv_per_msg']['pong'] + 32)
- assert_greater_than_or_equal(after['bytessent_per_msg']['ping'], before['bytessent_per_msg']['ping'] + 32)
+ 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)
def _test_getnetworkinginfo(self):
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)