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:
Christian Decker
2018-09-12 01:12:19 +02:00
parent 79da1b9aa2
commit f1e931f7bb

View File

@@ -931,10 +931,12 @@ def test_logging(node_factory):
wait_for(lambda: os.path.exists(logpath))
log1 = open(logpath_moved).readlines()
log2 = open(logpath).readlines()
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,