pytest: test that failing to start a plugin due to failure to exec does not put it in plugins list.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-08-17 10:17:34 +09:30
parent bc36a4580c
commit 04ddb4af8d
1 changed files with 13 additions and 1 deletions

View File

@ -9,7 +9,7 @@ from utils import (
DEPRECATED_APIS, expected_peer_features, expected_node_features,
expected_channel_features, account_balance,
check_coin_moves, first_channel_id, EXPERIMENTAL_DUAL_FUND,
mine_funding_to_announce
mine_funding_to_announce, VALGRIND
)
import ast
@ -4275,6 +4275,18 @@ def test_renepay_not_important(node_factory):
l1.rpc.plugin_start(os.path.join(os.getcwd(), 'plugins/cln-renepay'))
@pytest.mark.xfail(strict=True)
@unittest.skipIf(VALGRIND, "Valgrind doesn't handle bad #! lines the same")
def test_plugin_nostart(node_factory):
"Should not appear in list if it didn't even start"
l1 = node_factory.get_node()
with pytest.raises(RpcError, match="badinterp.py: opening pipe: No such file or directory"):
l1.rpc.plugin_start(os.path.join(os.getcwd(), 'tests/plugins/badinterp.py'))
assert [p['name'] for p in l1.rpc.plugin_list()['plugins'] if 'badinterp' in p['name']] == []
@pytest.mark.xfail(strict=True)
def test_plugin_startdir_lol(node_factory):
"""Though we fail to start many of them, we don't crash!"""