Browse Source

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 <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
parent
commit
d640dc3a6f
  1. 5
      tests/utils.py

5
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

Loading…
Cancel
Save