From d640dc3a6fa0ec09e3dfe05d05f3dc2f55edb2ec Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 26 Sep 2017 14:27:31 +0930 Subject: [PATCH] test_lightningd.py: fix wait_for_logs with duplicate entries. In the next test, we wait for multiple 'sendrawtx exit 0' which doesn't work because we use a set not a list, and the current code would match multiple against the same thing. The result was we didn't wait for the final sendrawtransaction, and occasionally had test failures as a result. Signed-off-by: Rusty Russell --- tests/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/utils.py b/tests/utils.py index e288b90ed..e502f17c0 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -107,7 +107,7 @@ class TailableProc(object): """ logging.debug("Waiting for {} in the logs".format(regexs)) - exs = {re.compile(r) for r in regexs} + exs = [re.compile(r) for r in regexs] start_time = time.time() pos = self.logsearch_start initial_pos = len(self.logs) @@ -130,10 +130,11 @@ class TailableProc(object): continue for r in exs.copy(): + self.logsearch_start = pos+1 if r.search(self.logs[pos]): logging.debug("Found '%s' in logs", r) exs.remove(r) - self.logsearch_start = pos+1 + break if len(exs) == 0: return self.logs[pos] pos += 1