Skip to content

Commit fa4595d

Browse files
author
MarcoFalke
committed
test: Remove random line number feature from feature_init.py
This is needed for the next commit. Also, it doesn't really test anything novel. wait_for_debug_log is inherently racy, so will randomly terminate at the exact point or later. So the randomization is already sufficiently covered by the existing test.
1 parent 5f4c07b commit fa4595d

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

test/functional/feature_init.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -85,37 +85,6 @@ def check_clean_start():
8585
check_clean_start()
8686
self.stop_node(0)
8787

88-
self.log.info(
89-
f"Terminate at some random point in the init process (max logs: {num_total_logs})")
90-
91-
for _ in range(40):
92-
num_logs = len(Path(node.debug_log_path).read_text().splitlines())
93-
additional_lines = random.randint(1, num_total_logs)
94-
self.log.debug(f"Starting node and will exit after {additional_lines} lines")
95-
node.start(extra_args=['-txindex=1'])
96-
logfile = open(node.debug_log_path, 'rb')
97-
98-
MAX_SECS_TO_WAIT = 10
99-
start = time.time()
100-
num_lines = 0
101-
102-
while True:
103-
line = logfile.readline()
104-
if line:
105-
num_lines += 1
106-
107-
if num_lines >= (num_logs + additional_lines) or \
108-
(time.time() - start) > MAX_SECS_TO_WAIT:
109-
self.log.debug(f"Terminating node after {num_lines} log lines seen")
110-
sigterm_node()
111-
break
112-
113-
if node.process.poll() is not None:
114-
raise AssertionError("node failed to start")
115-
116-
check_clean_start()
117-
self.stop_node(0)
118-
11988
self.log.info("Test startup errors after removing certain essential files")
12089

12190
files_to_disturb = {

0 commit comments

Comments
 (0)