Repository navigation
test: Avoid duplicate curl call in get_previous_releases.py - #30703
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
There was a problem hiding this comment.
tested ACK fa5aeab
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.
Seems odd having to translate
404to "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.99Before:
After: