From 1ea7e45a1f445d32a2b690d52befb2e63418653b Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Tue, 10 Dec 2024 19:25:22 +0100 Subject: [PATCH] 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 --- test/functional/test_framework/test_framework.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 7e8c40cf162..16069e522f9 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -526,6 +526,15 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): binary = [get_bin_from_version(v, 'bitcoind', self.options.bitcoind) for v in versions] if binary_cli is None: binary_cli = [get_bin_from_version(v, 'bitcoin-cli', self.options.bitcoincli) for v in versions] + # Fail test if any of the needed release binaries is missing + bins_missing = False + for bin_path in binary + binary_cli: + if shutil.which(bin_path) is None: + self.log.error(f"Binary not found: {bin_path}") + bins_missing = True + if bins_missing: + raise AssertionError("At least one release binary is missing. " + "Previous releases binaries can be downloaded via `test/get_previous_releases.py -b`.") assert_equal(len(extra_confs), num_nodes) assert_equal(len(extra_args), num_nodes) assert_equal(len(versions), num_nodes)