From 6dcd7f9d6d5c337d6bacce1965d53cb2c24b6ff0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 5 May 2017 16:11:46 +0930 Subject: [PATCH] tests: dump more information when we fail to find something in logs. Signed-off-by: Rusty Russell --- tests/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/utils.py b/tests/utils.py index de50980ef..bcf0e5dcd 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -108,9 +108,15 @@ class TailableProc(object): ex = re.compile(regex) start_time = time.time() pos = max(len(self.logs) - offset, 0) + initial_pos = len(self.logs) while True: - if time.time() > start_time + timeout: + print("Can't find {} in logs".format(regex)) + with self.logs_cond: + for i in range(initial_pos, len(self.logs)): + print(" " + self.logs[i]) + if self.is_in_log(regex): + print("(Was previously in logs!") raise TimeoutError('Unable to find "{}" in logs.'.format(regex)) elif not self.running: raise ValueError('Process died while waiting for logs')