diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-01-02 10:51:10 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-01-02 10:51:12 +0100 |
commit | 3ec4cc0a9e7c15740e1e0d8f1de45e76eb53e8f7 (patch) | |
tree | aad285f7811d356bb699af75f92d6b332f5ef2b1 | |
parent | 4f041ba14f68a5fcccf36aa7583190f1e141ad05 (diff) | |
parent | de23739b22fefd7a409f6cb0a4d6128c176fa229 (diff) |
Merge #15069: test: Fix rpc_net.py "pong" race condition
de23739b22 test: Fix rpc_net.py "pong" race condition (Ben Woosley)
Pull request description:
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.
Combined these to a single wait_until as well, which will be a bit more
forgiving re the timeout while still enforcing the same 2 seconds
overall.
https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21310881#L62
Tree-SHA512: dc60f95a0e139c104fd81c8a7e0c9b3c25907de26c9d4e5976ae490e8ed5db0f0c492cd0e996ef6b5eb02cae82a62d4551ed36f95601871b19472050b3247bc0
-rwxr-xr-x | test/functional/rpc_net.py | 4 |
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) |