mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
f4f6279b17
We modify broken.py to be able to fail at different points, and test that during startup. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
29 lines
637 B
Python
Executable File
29 lines
637 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Simple plugin to test that lightningd doesnt crash if it starts a
|
|
misbehaving plugin via RPC.
|
|
"""
|
|
from pyln.client import Plugin
|
|
import os
|
|
plugin = Plugin()
|
|
crash_at = os.environ.get("BROKEN_CRASH", "before_start")
|
|
|
|
|
|
@plugin.init()
|
|
def init(options, configuration, plugin):
|
|
plugin.log("broken.py initializing {}".format(configuration))
|
|
assert crash_at == "during_init"
|
|
plugin.does_not_exist()
|
|
|
|
|
|
@plugin.method("test_broken")
|
|
def test_broken():
|
|
return {}
|
|
|
|
|
|
if crash_at == "before_start":
|
|
assert False
|
|
elif crash_at == "during_getmanifest":
|
|
del plugin.methods['getmanifest']
|
|
|
|
plugin.run()
|