Skip to content

Commit 4207d9b

Browse files
committed
test: feature_init, ensure indexes are synced prior to perturbing files
1 parent abd07cf commit 4207d9b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/functional/feature_init.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ def start_expecting_error(err_fragment, args):
5454
match=ErrorMatch.PARTIAL_REGEX,
5555
)
5656

57-
def check_clean_start():
57+
def check_clean_start(extra_args):
5858
"""Ensure that node restarts successfully after various interrupts."""
59-
node.start()
59+
node.start(extra_args)
6060
node.wait_for_rpc_connection()
61-
assert_equal(200, node.getblockcount())
61+
height = node.getblockcount()
62+
assert_equal(200, height)
63+
self.wait_until(lambda: all(i["synced"] and i["best_block_height"] == height for i in node.getindexinfo().values()))
6264

6365
lines_to_terminate_after = [
6466
b'Validating signatures for all blocks',
@@ -97,7 +99,9 @@ def check_clean_start():
9799
self.log.debug("Terminating node after terminate line was found")
98100
sigterm_node()
99101

100-
check_clean_start()
102+
# Prior to deleting/perturbing index files, start node with all indexes enabled.
103+
# 'check_clean_start' will ensure indexes are synchronized (i.e., data exists to modify)
104+
check_clean_start(args)
101105
self.stop_node(0)
102106

103107
self.log.info("Test startup errors after removing certain essential files")
@@ -186,7 +190,7 @@ def check_clean_start():
186190
self.log.debug(f"Restoring file from {bak_path} and restarting")
187191
Path(bak_path).rename(target_file)
188192

189-
check_clean_start()
193+
check_clean_start(args)
190194
self.stop_node(0)
191195

192196
self.log.info("Test startup errors after perturbing certain essential files")

0 commit comments

Comments
 (0)