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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-06-26 14:05:01 +09:30
parent b1f393f355
commit 2f27aad8d0

View File

@@ -12,6 +12,7 @@ from utils import (
import os import os
import pytest import pytest
import subprocess import subprocess
import time
import unittest 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.proc.wait(WAIT_TIMEOUT) == HSM_BAD_PASSWORD)
assert(l1.daemon.is_in_log("Wrong password for encrypted hsm_secret.")) 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 # Test we can restore the same wallet with the same password
l1.daemon.start(stdin=slave_fd, wait_for_initialized=False) l1.daemon.start(stdin=slave_fd, wait_for_initialized=False)
l1.daemon.wait_for_log(r'The hsm_secret is encrypted') l1.daemon.wait_for_log(r'The hsm_secret is encrypted')