From 0b0708d86a80f22da2b2e6a00bd4e8378433d53c Mon Sep 17 00:00:00 2001 From: cornwarecjp Date: Tue, 30 Jan 2018 11:10:13 +0100 Subject: [PATCH] Bitcoind should always eventually finish starting, but there is no guarantee on how long it takes, so don't apply a time-out. In case bitcoind hangs indefinitely, the test will hang indefinitely too, but this should be solved in bitcoind, not in the test code. --- tests/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/utils.py b/tests/utils.py index f98669e20..ab1ca8d4a 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -127,6 +127,8 @@ class TailableProc(object): starting from last of the previous waited-for log entries (if any). We fail if the timeout is exceeded or if the underlying process exits before all the `regexs` were found. + + If timeout is None, no time-out is applied. """ logging.debug("Waiting for {} in the logs".format(regexs)) exs = [re.compile(r) for r in regexs] @@ -134,8 +136,8 @@ class TailableProc(object): pos = self.logsearch_start initial_pos = len(self.logs) while True: - if time.time() > start_time + timeout: - print("Can't find {} in logs".format(exs)) + if timeout is not None and time.time() > start_time + timeout: + print("Time-out: can't find {} in logs".format(exs)) for r in exs: if self.is_in_log(r): print("({} was previously in logs!)".format(r)) @@ -223,7 +225,7 @@ class BitcoinD(TailableProc): def start(self): TailableProc.start(self) - self.wait_for_log("Done loading", timeout=10) + self.wait_for_log("Done loading", timeout=None) logging.info("BitcoinD started")