test: Add rpc_bind test to default-run tests #12510

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2018_02_reinstate_rpcbind_test changing 2 files +64 −44
  1. laanwj commented at 2:48 PM on February 22, 2018: member

    Skip the parts that cannot be run on the host due to lack of IPv6 support or a second interface to bind on, and warn appropriately.

    Without no strong requirements (besides being Linux only, which will skip the test) left, add this test to the default in test_runner.

    (the non-IPv6 parts of the two dual-IPv4/6 tests could also be enabled, but first going to look what Travis does here to see if there wasn't another reason it was disabled) done, it only makes sense for the first

  2. laanwj added the label Tests on Feb 22, 2018
  3. in test/functional/rpc_bind.py:102 in 598b273781 outdated
     110 | -        # Check that with invalid rpcallowip, we are denied
     111 | -        self.run_allowip_test([non_loopback_ip], non_loopback_ip, defaultport)
     112 | -        assert_raises_rpc_error(-342, "non-JSON HTTP response with '403 Forbidden' from server", self.run_allowip_test, ['1.1.1.1'], non_loopback_ip, defaultport)
     113 | +            # Check that with invalid rpcallowip, we are denied
     114 | +            self.run_allowip_test([non_loopback_ip], non_loopback_ip, defaultport)
     115 | +            assert_raises_rpc_error(-342, "non-JSON HTTP response with '403 Forbidden' from server", self.run_allowip_test, ['1.1.1.1'], non_loopback_ip, defaultport)
    


    laanwj commented at 3:29 PM on February 22, 2018:

    The allowip test could also be done by connecting from a second loopback IP, say, 127.0.0.2. This would obliterate the need for a non loopback IP, but would need support in the test framework at the RPC/HTTP level for binding to a different address before outgoing connection (connecting to a different interface IP does that part automatically...)


    laanwj commented at 3:56 PM on February 22, 2018:

    Ughh, I tried this but it doesn't work. Apparently the entire IPv4 subnet is unconditionally allowed.

    rpc_allow_subnets.push_back(CSubNet(localv4, 8));      // always allow IPv4 local subnet
    

    (It works when removing the , 8 - the full changes are here: https://github.com/laanwj/bitcoin/commit/0dad20fe2f9ef3c053b007704f46fd1f0e26fc5f) (It would also work for IPv6, as it only binds on a single localhost IP there. But that won't help for Travis)


    randolf commented at 2:20 PM on March 18, 2018:

    @laanwj It depends on the IP stack implementation. Some only allow the use of only 127.0.0.1 while others seem to effectively bind 127/8. I think it would be best to rely only on 127.0.0.1 and ::1 for loopback-based IPv4/IPv6 compatibility checks.


    laanwj commented at 11:33 AM on April 2, 2018:

    This is a linux-specific test though, so in this test we can asume /8 and don't care about other IP stack implementations.

  4. laanwj force-pushed on Feb 22, 2018
  5. laanwj force-pushed on Feb 22, 2018
  6. laanwj assigned MarcoFalke on Mar 6, 2018
  7. laanwj closed this on Mar 14, 2018

  8. MarcoFalke commented at 1:47 PM on March 18, 2018: member

    utACK db9fd32284c8ad5b7f3b11efc0716324a5abd147

  9. MarcoFalke reopened this on Mar 18, 2018

  10. randolf approved
  11. randolf commented at 2:26 PM on March 18, 2018: contributor

    Issuing a warning when IPv6 is not present is a good idea in my opinion because all modern hosts really should have proper support for both IPv4 and IPv6 in these modern times.

    Vendors have had at least 15 years to add IPv6 support to their IP networking stacks: https://www.ipv6.com/general/ipv6-the-history-and-timeline/

  12. jnewbery commented at 5:44 PM on March 20, 2018: member

    I think there should be some indication in the test_runner summary that the full test has not been run. A printed warning log is not enough, since the user will have no indication that the test hasn't been fully executed.

    One way we could do this is to add options to the rpc_bind.py test. See https://github.com/jnewbery/bitcoin/commit/2361e82258675d52612675904565b15694fabed3 for example.

  13. MarcoFalke commented at 10:41 PM on April 1, 2018: member

    Needs rebase if still relevant

  14. laanwj commented at 11:38 AM on April 2, 2018: member

    Well the thought here was that running part of the test is better than not running it at all. Indeed, adding options for ipv4/ipv6 testing would be an option, But I feel we're overcomplicating this, this is also what made me unsure about this change.

    Vendors have had at least 15 years to add IPv6 support to their IP networking stacks: https://www.ipv6.com/general/ipv6-the-history-and-timeline/

    I agree - simply requiring localhost IPv6 support to run the test suite wouldn't be that extreme at this point. It'd be a much smaller change than this.

    If we can rely on Travis (finally) having IPv6 then I'm all for that.

  15. laanwj force-pushed on Apr 2, 2018
  16. laanwj commented at 11:50 AM on April 2, 2018: member

    Rebased and added a squasshme commit that skips the entire test if no IPv6 localhost. Probably should do the same for non_loopback_ip. But let's see how this goes on travis.

  17. laanwj commented at 2:52 PM on April 2, 2018: member

    So apparently travis still has no IPv6 support. Disappointing. This causes the test to be skipped on travis for now. That's ok, at least it will still run by default locally.

  18. jnewbery commented at 3:50 PM on April 2, 2018: member

    Changes look good. Will ACK once the commits are squashed.

    I think there's still value to running a subset of the tests when ipv6/non-loopback interfaces are not available, as long as it's clearly communicated to the user that the full test has not been run.

    I still think something like https://github.com/jnewbery/bitcoin/commit/2361e82258675d52612675904565b15694fabed3 could be useful in a future PR, so at least Travis is running a subset of this test.

  19. laanwj commented at 11:44 AM on April 3, 2018: member

    I still think something like jnewbery/bitcoin@2361e82 could be useful in a future PR, so at least Travis is running a subset of this test.

    Oh that's a good idea, I didn't think of splitting up the test into parts and still adding all the sub-parts to the default-run tests (so that they'll run locally) - will take that over.

  20. laanwj force-pushed on Apr 10, 2018
  21. laanwj force-pushed on Apr 10, 2018
  22. test: Add rpc_bind test to default-run tests
    Skip the parts that cannot be run on the host due to lack
    of IPv6 support or a second interface to bind on, and warn
    appropriately.
    
    Without no strong requirements (besides being Linux only, in which case
    the test is skipped) left, just add this test to the default in
    test_runner.
    
    Includes suggested changes by John Newbery.
    e87fefc60f
  23. laanwj force-pushed on Apr 13, 2018
  24. laanwj commented at 12:40 PM on April 13, 2018: member

    Took over @jnewbery's commit and did the rebase that was needed.

  25. jnewbery commented at 1:49 PM on April 13, 2018: member

    Thanks @laanwj . Will rereview.

    Travis failure was unrelated. p2p_compactblocks.py seems to be particularly flakey these days. I'll kick travis.

  26. laanwj merged this on Apr 23, 2018
  27. laanwj closed this on Apr 23, 2018

  28. laanwj referenced this in commit d5b2e98250 on Apr 23, 2018
  29. jnewbery commented at 3:49 PM on April 23, 2018: member

    post-merge tested ACK e87fefc60fc0f648b5e26aa716481e79a85f04de.

    Sorry for not rereviewing earlier - feel free to prod me if I've promised a review and not delivered!

  30. UdjinM6 referenced this in commit b7a7fc8c3b on Jul 9, 2020
  31. UdjinM6 referenced this in commit b8822dd78e on Jul 9, 2020
  32. UdjinM6 referenced this in commit f5c91d1826 on Jul 9, 2020
  33. UdjinM6 referenced this in commit fcd3029090 on Jul 12, 2020
  34. jasonbcox referenced this in commit 3a91cc08c7 on Oct 26, 2020
  35. MarcoFalke locked this on Sep 8, 2021

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-13 15:15 UTC

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