test: Avoid duplicate curl call in get_previous_releases.py #30703

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2408-test-less-curl changing 1 files +3 −14
  1. maflcko commented at 12:14 PM on August 23, 2024: member

    Seems odd having to translate 404 to "Binary tag was not found". Also, it seems odd to write a for-loop over a list with one item.

    Fix both issues by just using a single call to curl --fail ....

    Can be tested with: test/get_previous_releases.py -b v99.99.99

    Before:

    Releases directory: releases
    Fetching: https://bitcoincore.org/bin/bitcoin-core-99.99.99/bitcoin-99.99.99-x86_64-linux-gnu.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0  286k    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
    Binary tag was not found
    

    After:

    Releases directory: releases
    Fetching: https://bitcoincore.org/bin/bitcoin-core-99.99.99/bitcoin-99.99.99-x86_64-linux-gnu.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0  286k    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
    curl: (22) The requested URL returned error: 404
    
  2. test: Avoid duplicate curl call in get_previous_releases.py fa5aeab3cb
  3. DrahtBot commented at 12:14 PM on August 23, 2024: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK fanquake, brunoerg, tdb3

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

  4. DrahtBot added the label Tests on Aug 23, 2024
  5. fanquake approved
  6. fanquake commented at 3:05 PM on August 23, 2024: member

    ACK fa5aeab3cb18405ecf8a1401d89539b924a618f6

  7. brunoerg approved
  8. brunoerg commented at 6:36 PM on August 23, 2024: contributor

    utACK fa5aeab3cb18405ecf8a1401d89539b924a618f6

  9. tdb3 approved
  10. tdb3 commented at 7:59 PM on August 23, 2024: contributor

    tested ACK fa5aeab3cb18405ecf8a1401d89539b924a618f6 Seems to work well and is an elegant simplification. Thank you.

    Not that it seems to matter for callers of get_previous_releases.py, but just noting that previously download_binary() returned 1 on 404, while the new approach returns 22 (as documented in curl's man page, ...at least with curl 7.88.1 (x86_64-pc-linux-gnu)).

    previous:

    $ test/get_previous_releases.py -b v29.0
    Releases directory: releases
    Fetching: https://bitcoincore.org/bin/bitcoin-core-29.0/bitcoin-29.0-x86_64-linux-gnu.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0  286k    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    Binary tag was not found
    $ echo $?
    1
    

    new approach:

    $ test/get_previous_releases.py -b v29.0
    Releases directory: releases
    Fetching: https://bitcoincore.org/bin/bitcoin-core-29.0/bitcoin-29.0-x86_64-linux-gnu.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0  286k    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    curl: (22) The requested URL returned error: 404
    $ echo $?
    22
    

    Also tested that downloading a valid release (v23.0) was successful.

  11. fanquake merged this on Aug 24, 2024
  12. fanquake closed this on Aug 24, 2024

  13. maflcko deleted the branch on Aug 25, 2024
  14. bitcoin locked this on Aug 25, 2025

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-24 09:13 UTC

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