From 3d3e86e22c090f3cbb422f7c0711571c236a777c Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Mon, 9 Sep 2024 19:01:16 -0700 Subject: [PATCH] test: CI error fixes - Removes CI value error for Broken logs - Fixes CI errors due to deprecated listconfigs 'important-plugins' - Removed listchannels deprecated local test Changelog-None. --- tests/test_clnrest.py | 7 +++++-- tests/test_gossip.py | 34 ---------------------------------- tests/test_misc.py | 16 ++++++++-------- tests/test_plugin.py | 8 ++++---- 4 files changed, 17 insertions(+), 48 deletions(-) diff --git a/tests/test_clnrest.py b/tests/test_clnrest.py index 6683e636c..46cb6e7cf 100644 --- a/tests/test_clnrest.py +++ b/tests/test_clnrest.py @@ -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', @@ -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. diff --git a/tests/test_gossip.py b/tests/test_gossip.py index a87554d1f..d0a911b43 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -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, diff --git a/tests/test_misc.py b/tests/test_misc.py index 2d61aa48a..e4b4b148a 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -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): diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 9b8e3d3be..4357f0eb0 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -4343,10 +4343,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') @@ -4355,7 +4355,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'))