Bugfix: QA: rpc_bind: Skip nonloopback test if no such address is found #33433

pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:qafix_rpc_bind_nonloopback_unavail changing 1 files +4 −1
  1. luke-jr commented at 3:15 am on September 19, 2025: member

    Without this, I get:

     02025-09-19T03:14:05.157000Z TestFramework (INFO): PRNG seed is: 3218602557639511064
     12025-09-19T03:14:05.158000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin-test/a
     22025-09-19T03:14:05.158000Z TestFramework (INFO): Check for ipv6
     32025-09-19T03:14:05.158000Z TestFramework (INFO): Check for non-loopback interface
     42025-09-19T03:14:05.158000Z TestFramework (INFO): Bind test for []
     52025-09-19T03:14:05.516000Z TestFramework (INFO): Bind test for []
     62025-09-19T03:14:05.871000Z TestFramework (INFO): Bind test for ['[::1]']
     72025-09-19T03:14:06.227000Z TestFramework (INFO): Bind test for ['127.0.0.1', '[::1]']
     82025-09-19T03:14:06.583000Z TestFramework (INFO): Using interface None for testing
     92025-09-19T03:14:06.583000Z TestFramework (INFO): Bind test for [None]
    102025-09-19T03:14:06.583000Z TestFramework (ERROR): Unexpected exception
    11Traceback (most recent call last):
    12  File "/Bitcoin/bitcoin/workingtree/test/functional/test_framework/test_framework.py", line 135, in main
    13    self.run_test()
    14    ~~~~~~~~~~~~~^^
    15  File "/Bitcoin/bitcoin/workingtree/test/functional/rpc_bind.py", line 126, in run_test
    16    self._run_nonloopback_tests()
    17    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
    18  File "/Bitcoin/bitcoin/workingtree/test/functional/rpc_bind.py", line 157, in _run_nonloopback_tests
    19    self.run_bind_test([self.non_loopback_ip], self.non_loopback_ip, [self.non_loopback_ip],
    20    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    21        [(self.non_loopback_ip, self.defaultport)])
    22        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    23  File "/Bitcoin/bitcoin/workingtree/test/functional/rpc_bind.py", line 38, in run_bind_test
    24    expected = [(addr_to_hex(addr), port) for (addr, port) in expected]
    25                 ~~~~~~~~~~~^^^^^^
    26  File "/Bitcoin/bitcoin/workingtree/test/functional/test_framework/netutil.py", line 132, in addr_to_hex
    27    if '.' in addr: # IPv4
    28       ^^^^^^^^^^^
    29TypeError: argument of type 'NoneType' is not iterable
    
  2. Bugfix: QA: rpc_bind: Skip nonloopback test if no such address is found 79b4c276e7
  3. DrahtBot commented at 3:15 am on September 19, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33433.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, theStack

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. in test/functional/rpc_bind.py:87 in 79b4c276e7
    83@@ -84,7 +84,10 @@ def run_test(self):
    84         if not self.options.run_nonloopback:
    85             self._run_loopback_tests()
    86         if not self.options.run_ipv4 and not self.options.run_ipv6:
    87-            self._run_nonloopback_tests()
    88+            if self.non_loopback_ip:
    


    maflcko commented at 9:22 am on September 25, 2025:

    I don’t understand this change. This line of code is only run when not self.options.run_ipv4 and not self.options.run_ipv6. The whole test is only run when sum([self.options.run_ipv4, self.options.run_ipv6, self.options.run_nonloopback]) > 1. So self.options.run_nonloopback must be set.

    However, the previous check already guard this:

    0        if self.non_loopback_ip is None and self.options.run_nonloopback:
    1            raise SkipTest("This test requires a non-loopback ip address.")
    

    Please provide exact steps to reproduce, or an explanation why this patch is correct. Otherwise, this just makes it harder to review.


    luke-jr commented at 8:33 pm on October 7, 2025:

    The whole test is only run when sum([self.options.run_ipv4, self.options.run_ipv6, self.options.run_nonloopback]) > 1.

    No, that’s a failure condition (multiple options enabled)


    maflcko commented at 12:50 pm on October 8, 2025:
    oh, I got the logic exactly reversed (can be resolved)
  5. maflcko commented at 12:51 pm on October 8, 2025: member

    review ACK 79b4c276e7b9b526fa8f563b1e09b2b970baece6 🏑

    Signature:

    0untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
    1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    2trusted comment: review ACK 79b4c276e7b9b526fa8f563b1e09b2b970baece6 🏑
    3f/uM8aRVl9wKlCaisJ5LHxwuXFyHLl5n0HSLx7CQnuo3d0qYZqRPiO6/Pg6O+uz2UTxRkBdh4dtn0ExRzOuwCA==
    

    Can be tested via the diff:

     0diff --git a/test/functional/rpc_bind.py b/test/functional/rpc_bind.py
     1index c259608c94..e9cf08c427 100755
     2--- a/test/functional/rpc_bind.py
     3+++ b/test/functional/rpc_bind.py
     4@@ -106,10 +106,6 @@ class RPCBindTest(BitcoinTestFramework):
     5 
     6         self.log.info("Check for non-loopback interface")
     7         self.non_loopback_ip = None
     8-        for name,ip in all_interfaces():
     9-            if ip != '127.0.0.1':
    10-                self.non_loopback_ip = ip
    11-                break
    12         if self.non_loopback_ip is None and self.options.run_nonloopback:
    13             raise SkipTest("This test requires a non-loopback ip address.")
    14 
    
  6. maflcko added the label Tests on Oct 8, 2025
  7. theStack approved
  8. theStack commented at 3:35 pm on November 5, 2025: contributor

    Tested ACK 79b4c276e7b9b526fa8f563b1e09b2b970baece6

    Verified also in a local branch rebased on master, given that the merge-base is extremely old (>7 years).


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: 2025-11-06 06:13 UTC

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