test: feature_init, ensure indexes are synced prior to perturbing files
This commit is contained in:
1 file changed
+9
-5
@@ -54,11 +54,13 @@ class InitTest(BitcoinTestFramework):
|
|||||||
match=ErrorMatch.PARTIAL_REGEX,
|
match=ErrorMatch.PARTIAL_REGEX,
|
||||||
)
|
)
|
||||||
|
|
||||||
def check_clean_start():
|
def check_clean_start(extra_args):
|
||||||
"""Ensure that node restarts successfully after various interrupts."""
|
"""Ensure that node restarts successfully after various interrupts."""
|
||||||
node.start()
|
node.start(extra_args)
|
||||||
node.wait_for_rpc_connection()
|
node.wait_for_rpc_connection()
|
||||||
assert_equal(200, node.getblockcount())
|
height = node.getblockcount()
|
||||||
|
assert_equal(200, height)
|
||||||
|
self.wait_until(lambda: all(i["synced"] and i["best_block_height"] == height for i in node.getindexinfo().values()))
|
||||||
|
|
||||||
lines_to_terminate_after = [
|
lines_to_terminate_after = [
|
||||||
b'Validating signatures for all blocks',
|
b'Validating signatures for all blocks',
|
||||||
@@ -97,7 +99,9 @@ class InitTest(BitcoinTestFramework):
|
|||||||
self.log.debug("Terminating node after terminate line was found")
|
self.log.debug("Terminating node after terminate line was found")
|
||||||
sigterm_node()
|
sigterm_node()
|
||||||
|
|
||||||
check_clean_start()
|
# Prior to deleting/perturbing index files, start node with all indexes enabled.
|
||||||
|
# 'check_clean_start' will ensure indexes are synchronized (i.e., data exists to modify)
|
||||||
|
check_clean_start(args)
|
||||||
self.stop_node(0)
|
self.stop_node(0)
|
||||||
|
|
||||||
self.log.info("Test startup errors after removing certain essential files")
|
self.log.info("Test startup errors after removing certain essential files")
|
||||||
@@ -186,7 +190,7 @@ class InitTest(BitcoinTestFramework):
|
|||||||
self.log.debug(f"Restoring file from {bak_path} and restarting")
|
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(args)
|
||||||
self.stop_node(0)
|
self.stop_node(0)
|
||||||
|
|
||||||
self.log.info("Test startup errors after perturbing certain essential files")
|
self.log.info("Test startup errors after perturbing certain essential files")
|
||||||
|
|||||||
Reference in new issue
Block a user