mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
lightningd: have plugin-disable be more persistent.
The previous implementation was a bit lazy: in particular, since we didn't remember the disabled plugins, we would load them on rescan. Changelog-Changed: config: the `plugin-disable` option works even if specified before the plugin is found.
This commit is contained in:
@@ -273,13 +273,14 @@ def test_plugin_command(node_factory):
|
||||
def test_plugin_disable(node_factory):
|
||||
"""--disable-plugin works"""
|
||||
plugin_dir = os.path.join(os.getcwd(), 'contrib/plugins')
|
||||
# We need plugin-dir before disable-plugin!
|
||||
# We used to need plugin-dir before disable-plugin!
|
||||
n = node_factory.get_node(options=OrderedDict([('plugin-dir', plugin_dir),
|
||||
('disable-plugin',
|
||||
'{}/helloworld.py'
|
||||
.format(plugin_dir))]))
|
||||
with pytest.raises(RpcError):
|
||||
n.rpc.hello(name='Sun')
|
||||
assert n.daemon.is_in_log('helloworld.py: disabled via disable-plugin')
|
||||
|
||||
# Also works by basename.
|
||||
n = node_factory.get_node(options=OrderedDict([('plugin-dir', plugin_dir),
|
||||
@@ -287,6 +288,39 @@ def test_plugin_disable(node_factory):
|
||||
'helloworld.py')]))
|
||||
with pytest.raises(RpcError):
|
||||
n.rpc.hello(name='Sun')
|
||||
assert n.daemon.is_in_log('helloworld.py: disabled via disable-plugin')
|
||||
|
||||
# Other order also works!
|
||||
n = node_factory.get_node(options=OrderedDict([('disable-plugin',
|
||||
'helloworld.py'),
|
||||
('plugin-dir', plugin_dir)]))
|
||||
with pytest.raises(RpcError):
|
||||
n.rpc.hello(name='Sun')
|
||||
assert n.daemon.is_in_log('helloworld.py: disabled via disable-plugin')
|
||||
|
||||
# Both orders of explicit specification work.
|
||||
n = node_factory.get_node(options=OrderedDict([('disable-plugin',
|
||||
'helloworld.py'),
|
||||
('plugin',
|
||||
'{}/helloworld.py'
|
||||
.format(plugin_dir))]))
|
||||
with pytest.raises(RpcError):
|
||||
n.rpc.hello(name='Sun')
|
||||
assert n.daemon.is_in_log('helloworld.py: disabled via disable-plugin')
|
||||
|
||||
# Both orders of explicit specification work.
|
||||
n = node_factory.get_node(options=OrderedDict([('plugin',
|
||||
'{}/helloworld.py'
|
||||
.format(plugin_dir)),
|
||||
('disable-plugin',
|
||||
'helloworld.py')]))
|
||||
with pytest.raises(RpcError):
|
||||
n.rpc.hello(name='Sun')
|
||||
assert n.daemon.is_in_log('helloworld.py: disabled via disable-plugin')
|
||||
|
||||
# Still disabled if we load directory.
|
||||
n.rpc.plugin_startdir(directory=os.path.join(os.getcwd(), "contrib/plugins"))
|
||||
n.daemon.wait_for_log('helloworld.py: disabled via disable-plugin')
|
||||
|
||||
|
||||
def test_plugin_hook(node_factory, executor):
|
||||
|
||||
Reference in New Issue
Block a user