From 2f27aad8d01e9dd02873d1d4163e09e72794a45e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 26 Jun 2022 14:05:01 +0930 Subject: [PATCH] pytest: fix flake in test_wallet.py::test_hsm_secret_encryption Under valgrind, at least, this test fails regularly, and this sleep fixes it. Signed-off-by: Rusty Russell --- tests/test_wallet.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 7fa9a0478..00985245b 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -12,6 +12,7 @@ from utils import ( import os import pytest import subprocess +import time import unittest @@ -1044,6 +1045,12 @@ def test_hsm_secret_encryption(node_factory): assert(l1.daemon.proc.wait(WAIT_TIMEOUT) == HSM_BAD_PASSWORD) assert(l1.daemon.is_in_log("Wrong password for encrypted hsm_secret.")) + # Not sure why this helps, but seems to reduce flakiness where + # tail() thread in testing/utils.py gets 'ValueError: readline of + # closed file' and we get `ValueError: Process died while waiting for logs` + # when waiting for "Server started with public key" below. + time.sleep(10) + # Test we can restore the same wallet with the same password l1.daemon.start(stdin=slave_fd, wait_for_initialized=False) l1.daemon.wait_for_log(r'The hsm_secret is encrypted')