Skip to content

Commit

Permalink
test: feature_init: tweak all .ldb files of a certain type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jamesob committed Dec 29, 2021
1 parent a8ffbc0 commit 24fcf6e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/functional/feature_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,12 @@ def check_clean_start():
}

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))

self.log.info(f"Tweaking file to ensure failure {target_file}")
bak_path = str(target_file) + ".bak"
target_file.rename(bak_path)
for target_file in target_files:
self.log.info(f"Tweaking file to ensure failure {target_file}")
bak_path = str(target_file) + ".bak"
target_file.rename(bak_path)

# TODO: at some point, we should test perturbing the files instead of removing
# them, e.g.
Expand All @@ -176,8 +177,11 @@ def check_clean_start():
match=ErrorMatch.PARTIAL_REGEX,
)

self.log.info(f"Restoring file from {bak_path} and restarting")
Path(bak_path).rename(target_file)
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)

check_clean_start()
self.stop_node(0)

Expand Down

0 comments on commit 24fcf6e

Please sign in to comment.