test: Fix intermittent rpc_net issue #20299

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2011-testNet changing 1 files +4 −5
  1. MarcoFalke commented at 10:03 am on November 4, 2020: member

    The test fails because getpeerinfo and getnettotals are not synchronised, so a wait_until is needed for each RPC (separately).

    Fixes https://cirrus-ci.com/task/4663366629195776?command=ci#L5034

  2. DrahtBot added the label Tests on Nov 4, 2020
  3. jnewbery commented at 11:58 am on November 4, 2020: member

    utACK face870a8a

    Thanks for fixing this!

    I don’t quite understand the “get the id from the peer info and then get the peer info from the id” step. Could be simplified with:

     0--- a/test/functional/rpc_net.py
     1+++ b/test/functional/rpc_net.py
     2@@ -113,11 +113,10 @@ class NetTest(BitcoinTestFramework):
     3         self.wait_until(lambda: (self.nodes[0].getnettotals()['totalbytessent'] >= net_totals_before['totalbytessent'] + 32 * 2), timeout=1)
     4         self.wait_until(lambda: (self.nodes[0].getnettotals()['totalbytesrecv'] >= net_totals_before['totalbytesrecv'] + 32 * 2), timeout=1)
     5 
     6-        for peer_id in [p['id'] for p in peer_info_before]:
     7-            before = next(p for p in peer_info_before if p['id'] == peer_id)
     8-            after = lambda: next(p for p in self.nodes[0].getpeerinfo() if p['id'] == peer_id)
     9-            self.wait_until(lambda: after()['bytesrecv_per_msg'].get('pong', 0) >= before['bytesrecv_per_msg'].get('pong', 0) + 32, timeout=1)
    10-            self.wait_until(lambda: after()['bytessent_per_msg'].get('ping', 0) >= before['bytessent_per_msg'].get('ping', 0) + 32, timeout=1)
    11+        for peer_before in peer_info_before:
    12+            peer_after = lambda: next(p for p in self.nodes[0].getpeerinfo() if p['id'] == peer_before['id'])
    13+            self.wait_until(lambda: peer_after()['bytesrecv_per_msg'].get('pong', 0) >= peer_before['bytesrecv_per_msg'].get('pong', 0) + 32, timeout=1)
    14+            self.wait_until(lambda: peer_after()['bytessent_per_msg'].get('ping', 0) >= peer_before['bytessent_per_msg'].get('ping', 0) + 32, timeout=1)
    15 
    16     def test_getnetworkinfo(self):
    17         self.log.info("Test getnetworkinfo")
    
  4. test: Fix intermittent rpc_net issue fa2ecadd0d
  5. MarcoFalke force-pushed on Nov 4, 2020
  6. jnewbery commented at 12:24 pm on November 4, 2020: member
    utACK fa2ecadd0d3283a89d27772dc0275e76277ae17e
  7. MarcoFalke merged this on Nov 4, 2020
  8. MarcoFalke closed this on Nov 4, 2020

  9. MarcoFalke deleted the branch on Nov 4, 2020
  10. sidhujag referenced this in commit 683e0fbb35 on Nov 5, 2020
  11. deadalnix referenced this in commit 123f1731af on Dec 21, 2021
  12. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me