pytest: Give details about which node exited with a return code != 0

This commit is contained in:
Christian Decker
2019-11-29 16:11:39 +01:00
parent 518c43a9c2
commit 15f04d5fff
2 changed files with 3 additions and 5 deletions

View File

@@ -170,7 +170,7 @@ def node_factory(request, directory, test_name, bitcoind, executor, db_provider,
def map_node_error(nodes, f, msg): def map_node_error(nodes, f, msg):
for n in nodes: for n in nodes:
if n and f(n): if n and f(n):
teardown_checks.add_node_error(n, msg) teardown_checks.add_node_error(n, msg.format(n=n))
map_node_error(nf.nodes, printValgrindErrors, "reported valgrind errors") map_node_error(nf.nodes, printValgrindErrors, "reported valgrind errors")
map_node_error(nf.nodes, printCrashLog, "had crash.log files") map_node_error(nf.nodes, printCrashLog, "had crash.log files")
@@ -181,9 +181,7 @@ def node_factory(request, directory, test_name, bitcoind, executor, db_provider,
map_node_error(nf.nodes, lambda n: n.daemon.is_in_log('bad hsm request'), "had bad hsm requests") map_node_error(nf.nodes, lambda n: n.daemon.is_in_log('bad hsm request'), "had bad hsm requests")
map_node_error(nf.nodes, lambda n: n.daemon.is_in_log(r'Accessing a null column'), "Accessing a null column") map_node_error(nf.nodes, lambda n: n.daemon.is_in_log(r'Accessing a null column'), "Accessing a null column")
map_node_error(nf.nodes, checkMemleak, "had memleak messages") map_node_error(nf.nodes, checkMemleak, "had memleak messages")
map_node_error(nf.nodes, lambda n: n.rc != 0 and not n.may_fail, "Node exited with return code {n.rc}")
if not ok:
teardown_checks.add_error("At least one lightning exited with unexpected non-zero return code")
def getValgrindErrors(node): def getValgrindErrors(node):

View File

@@ -568,7 +568,7 @@ def test_transaction_annotations(node_factory, bitcoind):
@unittest.skipIf(VALGRIND, "It does not play well with prompt and key derivation.") @unittest.skipIf(VALGRIND, "It does not play well with prompt and key derivation.")
def test_hsm_secret_encryption(node_factory): def test_hsm_secret_encryption(node_factory):
l1 = node_factory.get_node() l1 = node_factory.get_node(may_fail=True) # May fail when started without key
password = "reckful\n" password = "reckful\n"
# We need to simulate a terminal to use termios in `lightningd`. # We need to simulate a terminal to use termios in `lightningd`.
master_fd, slave_fd = os.openpty() master_fd, slave_fd = os.openpty()