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: member

    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. 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)

  4. 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.")
     
    
  5. maflcko added the label Tests on Oct 8, 2025
  6. theStack approved
  7. 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).

  8. 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
  9. fanquake merged this on Nov 10, 2025
  10. fanquake closed this on Nov 10, 2025

Labels

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-04-14 15:12 UTC

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