mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
pytest: Fix flaky test_logging
File was rotated away but didn't wait for the first line to be actually written.
This commit is contained in:
@@ -931,10 +931,12 @@ def test_logging(node_factory):
|
|||||||
wait_for(lambda: os.path.exists(logpath))
|
wait_for(lambda: os.path.exists(logpath))
|
||||||
|
|
||||||
log1 = open(logpath_moved).readlines()
|
log1 = open(logpath_moved).readlines()
|
||||||
log2 = open(logpath).readlines()
|
|
||||||
|
|
||||||
assert log1[-1].endswith("Ending log due to SIGHUP\n")
|
assert log1[-1].endswith("Ending log due to SIGHUP\n")
|
||||||
assert log2[0].endswith("Started log due to SIGHUP\n")
|
|
||||||
|
def check_new_log():
|
||||||
|
log2 = open(logpath).readlines()
|
||||||
|
return len(log2) > 1 and log2[0].endswith("Started log due to SIGHUP\n")
|
||||||
|
wait_for(check_new_log)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(VALGRIND and not DEVELOPER,
|
@unittest.skipIf(VALGRIND and not DEVELOPER,
|
||||||
|
|||||||
Reference in New Issue
Block a user