0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-10 10:52:31 -05:00

test: feature_init: tweak all .ldb files of a certain type

This part of the test sporadically fails on CI infrastructure. Instead
of perturbing a single .ldb file of each type, move all .ldb files of a
given type to ensure a bad startup.
This commit is contained in:
James O'Beirne 2021-12-10 14:31:01 -05:00
parent a8ffbc01db
commit 24fcf6e435
No known key found for this signature in database
GPG key ID: 7A935DADB2C44F05

View file

@ -152,8 +152,9 @@ class InitStressTest(BitcoinTestFramework):
} }
for file_patt, err_fragment in files_to_disturb.items(): for file_patt, err_fragment in files_to_disturb.items():
target_file = list(node.chain_path.glob(file_patt))[0] target_files = list(node.chain_path.glob(file_patt))
for target_file in target_files:
self.log.info(f"Tweaking file to ensure failure {target_file}") self.log.info(f"Tweaking file to ensure failure {target_file}")
bak_path = str(target_file) + ".bak" bak_path = str(target_file) + ".bak"
target_file.rename(bak_path) target_file.rename(bak_path)
@ -176,8 +177,11 @@ class InitStressTest(BitcoinTestFramework):
match=ErrorMatch.PARTIAL_REGEX, match=ErrorMatch.PARTIAL_REGEX,
) )
self.log.info(f"Restoring file from {bak_path} and restarting") for target_file in target_files:
bak_path = str(target_file) + ".bak"
self.log.debug(f"Restoring file from {bak_path} and restarting")
Path(bak_path).rename(target_file) Path(bak_path).rename(target_file)
check_clean_start() check_clean_start()
self.stop_node(0) self.stop_node(0)