test: 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: contributor

    Without this, I get:

    2025-09-19T03:14:05.157000Z TestFramework (INFO): PRNG seed is: 3218602557639511064
    2025-09-19T03:14:05.158000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin-test/a
    2025-09-19T03:14:05.158000Z TestFramework (INFO): Check for ipv6
    2025-09-19T03:14:05.158000Z TestFramework (INFO): Check for non-loopback interface
    2025-09-19T03:14:05.158000Z TestFramework (INFO): Bind test for []
    2025-09-19T03:14:05.516000Z TestFramework (INFO): Bind test for []
    2025-09-19T03:14:05.871000Z TestFramework (INFO): Bind test for ['[::1]']
    2025-09-19T03:14:06.227000Z TestFramework (INFO): Bind test for ['127.0.0.1', '[::1]']
    2025-09-19T03:14:06.583000Z TestFramework (INFO): Using interface None for testing
    2025-09-19T03:14:06.583000Z TestFramework (INFO): Bind test for [None]
    2025-09-19T03:14:06.583000Z TestFramework (ERROR): Unexpected exception
    Traceback (most recent call last):
      File "/Bitcoin/bitcoin/workingtree/test/functional/test_framework/test_framework.py", line 135, in main
        self.run_test()
        ~~~~~~~~~~~~~^^
      File "/Bitcoin/bitcoin/workingtree/test/functional/rpc_bind.py", line 126, in run_test
        self._run_nonloopback_tests()
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
      File "/Bitcoin/bitcoin/workingtree/test/functional/rpc_bind.py", line 157, in _run_nonloopback_tests
        self.run_bind_test([self.non_loopback_ip], self.non_loopback_ip, [self.non_loopback_ip],
        ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            [(self.non_loopback_ip, self.defaultport)])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Bitcoin/bitcoin/workingtree/test/functional/rpc_bind.py", line 38, in run_bind_test
        expected = [(addr_to_hex(addr), port) for (addr, port) in expected]
                     ~~~~~~~~~~~^^^^^^
      File "/Bitcoin/bitcoin/workingtree/test/functional/test_framework/netutil.py", line 132, in addr_to_hex
        if '.' in addr: # IPv4
           ^^^^^^^^^^^
    TypeError: 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

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  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:

            if self.non_loopback_ip is None and self.options.run_nonloopback:
                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 🏑

    <details><summary>Show signature</summary>

    Signature:

    untrusted 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}"
    RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    trusted comment: review ACK 79b4c276e7b9b526fa8f563b1e09b2b970baece6 🏑
    f/uM8aRVl9wKlCaisJ5LHxwuXFyHLl5n0HSLx7CQnuo3d0qYZqRPiO6/Pg6O+uz2UTxRkBdh4dtn0ExRzOuwCA==
    

    </details>

    Can be tested via the diff:

    diff --git a/test/functional/rpc_bind.py b/test/functional/rpc_bind.py
    index c259608c94..e9cf08c427 100755
    --- a/test/functional/rpc_bind.py
    +++ b/test/functional/rpc_bind.py
    @@ -106,10 +106,6 @@ class RPCBindTest(BitcoinTestFramework):
     
             self.log.info("Check for non-loopback interface")
             self.non_loopback_ip = None
    -        for name,ip in all_interfaces():
    -            if ip != '127.0.0.1':
    -                self.non_loopback_ip = ip
    -                break
             if self.non_loopback_ip is None and self.options.run_nonloopback:
                 raise SkipTest("This test requires a non-loopback ip address.")
     
    
  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).

  9. fanquake renamed this:
    Bugfix: QA: rpc_bind: Skip nonloopback test if no such address is found
    test: rpc_bind: Skip nonloopback test if no such address is found
    on Nov 10, 2025
  10. fanquake merged this on Nov 10, 2025
  11. fanquake closed this on Nov 10, 2025

  12. sedited referenced this in commit 94f024ad07 on Nov 11, 2025
  13. yuvicc referenced this in commit f620a2206b on Nov 16, 2025
  14. stringintech referenced this in commit 52fffa1e5d on Nov 24, 2025
  15. stickies-v referenced this in commit 9fa736f8e4 on Jan 22, 2026
  16. Kino1994 referenced this in commit 15af1927d1 on Jun 28, 2026
  17. BigcoinBGC referenced this in commit c6b14a3135 on Jun 30, 2026
  18. Kino1994 referenced this in commit 4b5deff107 on Aug 19, 2026
  19. bitcoin locked this on Nov 10, 2026

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: 2026-11-27 03:51 UTC

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