Skip to content

Commit

Permalink
test: CI error fixes
Browse files Browse the repository at this point in the history
- Removes CI value error for Broken logs
- Fixes CI errors due to deprecated listconfigs 'important-plugins'
- Removed listchannels deprecated local test

Changelog-None.
  • Loading branch information
ShahanaFarooqui committed Sep 10, 2024
1 parent 10ccf62 commit 3a5b3d9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 48 deletions.
7 changes: 5 additions & 2 deletions tests/test_clnrest.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,9 @@ def test_clnrest_old_params(node_factory):
base_url = f'https://{rest_host}:{rest_port}'
l1 = node_factory.get_node(options={'rest-port': rest_port,
'rest-host': rest_host,
'allow-deprecated-apis': True})
'allow-deprecated-apis': True},
broken_log=r'DEPRECATED API USED rest-*')

# This might happen really early!
l1.daemon.logsearch_start = 0
l1.daemon.wait_for_logs([r'UNUSUAL lightningd: Option rest-port=.* deprecated in v23\.11, renaming to clnrest-port',
Expand All @@ -477,7 +479,8 @@ def test_clnrest_old_params(node_factory):
l2 = node_factory.get_node(options={'rest-port': rest_port,
'rest-host': rest_host,
'plugin': plugin,
'allow-deprecated-apis': True})
'allow-deprecated-apis': True},
broken_log=r'DEPRECATED API USED rest-*')

l2.daemon.logsearch_start = 0
# We still rename this one, since it's for clnrest.
Expand Down
34 changes: 0 additions & 34 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2017,40 +2017,6 @@ def test_dump_own_gossip(node_factory):
assert expect == []


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,
'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)
# This will be in block 104
node_factory.join_nodes([l2, l3], wait_for_announce=False)
l2l3 = first_scid(l2, l3)

# Non-deprecated nodes say no.
assert l1.rpc.listchannels() == {'channels': []}
assert l3.rpc.listchannels() == {'channels': []}
# Deprecated API lists both sides of local channels:

vals = [(c['active'], c['public'], c['short_channel_id']) for c in l2.rpc.listchannels()['channels']]
# Either order
assert vals == [(True, False, l1l2)] * 2 + [(True, False, l2l3)] * 2 or vals == [(True, False, l2l3)] * 2 + [(True, False, l1l2)] * 2

# Mine l1-l2 channel so it's public.
bitcoind.generate_block(4)
sync_blockheight(bitcoind, [l1, l2, l3])

wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 2)
wait_for(lambda: len(l3.rpc.listchannels()['channels']) == 2)

# l2 shows public one correctly, and private one correctly
# Either order
vals = [(c['active'], c['public'], c['short_channel_id']) for c in l2.rpc.listchannels()['channels']]
assert vals == [(True, True, l1l2)] * 2 + [(True, False, l2l3)] * 2 or vals == [(True, False, l2l3)] * 2 + [(True, True, l1l2)] * 2


def test_gossip_throttle(node_factory, bitcoind, chainparams):
"""Make some gossip, test it gets throttled"""
l1, l2, l3, l4 = node_factory.line_graph(4, wait_for_announce=True,
Expand Down
16 changes: 8 additions & 8 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,15 +856,15 @@ def test_listconfigs(node_factory, bitcoind, chainparams):


def test_listconfigs_plugins(node_factory, bitcoind, chainparams):
l1 = node_factory.get_node(options={'allow-deprecated-apis': True})
l1 = node_factory.get_node()

configs = l1.rpc.listconfigs()
assert configs['important-plugins']
assert len([p for p in configs['important-plugins'] if p['name'] == "pay"]) == 1
for p in configs['important-plugins']:
assert p['name'] and len(p['name']) > 0
assert p['path'] and len(p['path']) > 0
assert os.path.isfile(p['path']) and os.access(p['path'], os.X_OK)
configs = l1.rpc.listconfigs()['configs']
assert len(configs['important-plugin']['values_str']) == 0
assert len(configs['i-promise-to-fix-broken-api-user']['values_str']) == 0

plugins = l1.rpc.plugin_list()['plugins']
assert [p['active'] for p in plugins if p['name'].endswith('sql')] == [True]
assert [p['active'] for p in plugins if p['name'].endswith('offers')] == [True]


def test_multirpc(node_factory):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4331,10 +4331,10 @@ def test_dynamic_option_python_plugin(node_factory):

def test_renepay_not_important(node_factory):
# I mean, it's *important*, it's just not "mission-critical" just yet!
l1 = node_factory.get_node(options={'allow-deprecated-apis': True})
l1 = node_factory.get_node()

assert not any([p['name'] == 'cln-renepay' for p in l1.rpc.listconfigs()['important-plugins']])
assert [p['name'] for p in l1.rpc.listconfigs()['plugins'] if p['name'] == 'cln-renepay'] == ['cln-renepay']
assert 'cln-renepay' not in l1.rpc.listconfigs()['configs']['important-plugin']['values_str']
assert [p['active'] for p in l1.rpc.plugin_list()['plugins'] if p['name'].endswith('cln-renepay')] == [True]

# We can kill it without cln dying.
line = l1.daemon.is_in_log(r'.*started\([0-9]*\).*plugins/cln-renepay')
Expand All @@ -4343,7 +4343,7 @@ def test_renepay_not_important(node_factory):
l1.daemon.wait_for_log('plugin-cln-renepay: Killing plugin: exited during normal operation')

# But we don't shut down, and we can restrart.
assert [p['name'] for p in l1.rpc.listconfigs()['plugins'] if p['name'] == 'cln-renepay'] == []
assert [p for p in l1.rpc.plugin_list()['plugins'] if p['name'].endswith('cln-renepay')] == []
l1.rpc.plugin_start(os.path.join(os.getcwd(), 'plugins/cln-renepay'))


Expand Down

0 comments on commit 3a5b3d9

Please sign in to comment.