Skip to content

Commit 1ea7e45

Browse files
committed
test: raise explicit error if any of the needed release binaries is missing
If the `releases` directory exists, but still only a subset of the necessary previous release binaries are available, the test fails by throwing an exception (sometimes leading to follow-up exceptions like "AssertionError: [node 0] Error: no RPC connection") and printing out a stack trace, which can be confusing and at a first glance suggests that the node crashed or some alike. Improve this by checking and printing out *all* of the missing release binaries and failing with an explicit error in this case. Also add an info on how to download previous releases binaries. Noticed while testing #30328. Can be tested by e.g. $ ./test/get_previous_releases.py -b $ rm -rf ./releases/v28.0/ $ ./build/test/functional/wallet_migration.py
1 parent c506f2c commit 1ea7e45

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,15 @@ def get_bin_from_version(version, bin_name, bin_default):
526526
binary = [get_bin_from_version(v, 'bitcoind', self.options.bitcoind) for v in versions]
527527
if binary_cli is None:
528528
binary_cli = [get_bin_from_version(v, 'bitcoin-cli', self.options.bitcoincli) for v in versions]
529+
# Fail test if any of the needed release binaries is missing
530+
bins_missing = False
531+
for bin_path in binary + binary_cli:
532+
if shutil.which(bin_path) is None:
533+
self.log.error(f"Binary not found: {bin_path}")
534+
bins_missing = True
535+
if bins_missing:
536+
raise AssertionError("At least one release binary is missing. "
537+
"Previous releases binaries can be downloaded via `test/get_previous_releases.py -b`.")
529538
assert_equal(len(extra_confs), num_nodes)
530539
assert_equal(len(extra_args), num_nodes)
531540
assert_equal(len(versions), num_nodes)

0 commit comments

Comments
 (0)