Skip to content

pyln-testing: fix catching of memleak/broken errors at exit. #7573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contrib/pyln-testing/pyln/testing/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ def checkBadGossip(node):


def checkBroken(node):
node.daemon.logs_catchup()
broken_lines = [l for l in node.daemon.logs if '**BROKEN**' in l]
if node.broken_log:
ex = re.compile(node.broken_log)
Expand Down
8 changes: 6 additions & 2 deletions tests/test_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,9 @@ def test_penalty_inhtlc(node_factory, bitcoind, executor, chainparams, anchors):

# FIXME: | for dicts was added in Python 3.9 apparently.
l1, l2 = node_factory.line_graph(2, opts=[{**opts, **{'may_fail': True,
'feerates': (7500, 7500, 7500, 7500)}},
'feerates': (7500, 7500, 7500, 7500),
# We try to cheat!
'broken_log': r"onchaind-chan#[0-9]*: Could not find resolution for output .*: did \*we\* cheat\?"}},
opts])

channel_id = first_channel_id(l1, l2)
Expand Down Expand Up @@ -646,7 +648,9 @@ def test_penalty_outhtlc(node_factory, bitcoind, executor, chainparams, anchors)
# Feerates identical so we don't get gratuitous commit to update them
l1, l2 = node_factory.line_graph(2,
opts=[{**opts, **{'may_fail': True,
'feerates': (7500, 7500, 7500, 7500)}},
'feerates': (7500, 7500, 7500, 7500),
# We try to cheat!
'broken_log': r"onchaind-chan#[0-9]*: Could not find resolution for output .*: did \*we\* cheat\?"}},
opts])
channel_id = first_channel_id(l1, l2)

Expand Down
3 changes: 2 additions & 1 deletion tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,8 @@ def test_dump_own_gossip(node_factory):
def test_listchannels_deprecated_local(node_factory, bitcoind):
"""Test listchannels shows local/private channels only in deprecated mode"""
l1, l2, l3 = node_factory.get_nodes(3,
opts=[{}, {'allow-deprecated-apis': True}, {}])
opts=[{}, {'allow-deprecated-apis': True,
'broken_log': 'plugin-topology: DEPRECATED API USED: listchannels.include_private'}, {}])
# This will be in block 103
node_factory.join_nodes([l1, l2], wait_for_announce=False)
l1l2 = first_scid(l1, l2)
Expand Down
6 changes: 4 additions & 2 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,8 @@ def check_new_log():
@unittest.skipIf(VALGRIND,
"Valgrind sometimes fails assert on injected SEGV")
def test_crashlog(node_factory):
l1 = node_factory.get_node(may_fail=True)
l1 = node_factory.get_node(may_fail=True,
broken_log=' lightningd: ')

def has_crash_log(n):
files = os.listdir(os.path.join(n.daemon.lightning_dir, TEST_NETWORK))
Expand Down Expand Up @@ -2305,7 +2306,8 @@ def test_dev_force_bip32_seed(node_factory):


def test_dev_demux(node_factory):
l1 = node_factory.get_node(may_fail=True)
l1 = node_factory.get_node(may_fail=True,
broken_log=' lightningd: ')

# Check should work.
l1.rpc.check(command_to_check='dev', subcommand='crash')
Expand Down
6 changes: 4 additions & 2 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ def test_libplugin_deprecated(node_factory):
'somearg-deprecated': 'test_opt depr',
'allow-deprecated-apis': True},
# testrpc-deprecated causes a complaint!
)
broken_log='DEPRECATED API USED')

assert l1.daemon.is_in_log("somearg = test_opt depr")
l1.rpc.help('testrpc-deprecated')
Expand Down Expand Up @@ -2006,7 +2006,9 @@ def test_watchtower(node_factory, bitcoind, directory, chainparams):
p = os.path.join(os.path.dirname(__file__), "plugins/watchtower.py")
l1, l2 = node_factory.line_graph(
2,
opts=[{'may_fail': True}, {'plugin': p}]
opts=[{'may_fail': True,
'broken_log': r"onchaind-chan#[0-9]*: Could not find resolution for output .*: did \*we\* cheat\?"},
{'plugin': p}]
)
channel_id = l1.rpc.listpeerchannels()['channels'][0]['channel_id']

Expand Down
Loading