mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
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>
This commit is contained in:
@@ -107,7 +107,7 @@ class TailableProc(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
logging.debug("Waiting for {} in the logs".format(regexs))
|
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()
|
start_time = time.time()
|
||||||
pos = self.logsearch_start
|
pos = self.logsearch_start
|
||||||
initial_pos = len(self.logs)
|
initial_pos = len(self.logs)
|
||||||
@@ -130,10 +130,11 @@ class TailableProc(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
for r in exs.copy():
|
for r in exs.copy():
|
||||||
|
self.logsearch_start = pos+1
|
||||||
if r.search(self.logs[pos]):
|
if r.search(self.logs[pos]):
|
||||||
logging.debug("Found '%s' in logs", r)
|
logging.debug("Found '%s' in logs", r)
|
||||||
exs.remove(r)
|
exs.remove(r)
|
||||||
self.logsearch_start = pos+1
|
break
|
||||||
if len(exs) == 0:
|
if len(exs) == 0:
|
||||||
return self.logs[pos]
|
return self.logs[pos]
|
||||||
pos += 1
|
pos += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user