We didn't update this when we extended the timeout to 120 seconds in
ee3133f198 ("lightningd: increase
startup time for plugins to 120 seconds.")
```
def test_failing_plugins(directory):
fail_plugins = [
os.path.join(os.getcwd(), 'contrib/plugins/fail/failtimeout.py'),
os.path.join(os.getcwd(), 'contrib/plugins/fail/doesnotexist.py'),
]
for p in fail_plugins:
> with pytest.raises(subprocess.CalledProcessError):
E Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
tests/test_plugin.py:420: Failed
----------------------------- Captured stdout call -----------------------------
{'github_repository': 'ElementsProject/lightning', 'github_sha': '83dca18c5e9610bfaac766f957387b9a1ec48f50', 'github_ref': 'refs/pull/7887/merge', 'github_ref_name': 'HEAD', 'github_run_id': 13253210143, 'github_head_ref': 'guilt/bolt-updates-after-24.11', 'github_run_number': 12237, 'github_base_ref': 'master', 'github_run_attempt': '2', 'testname': 'test_failing_plugins', 'start_time': 1739239278, 'end_time': 1739239340, 'outcome': 'fail'}
=========================== short test summary info ============================
FAILED tests/test_plugin.py::test_failing_plugins - Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
============= 1 failed, 80 passed, 2 skipped in 855.37s (0:14:15) ==============
```
59 lines
1.2 KiB
Python
Executable File
59 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""An example plugin that fails to answer to `getmanifest`
|
|
|
|
Used to test the `getmanifest` timeout.
|
|
"""
|
|
import json
|
|
import sys
|
|
import time
|
|
|
|
|
|
def json_getmanifest(request, **kwargs):
|
|
# Timeout is 120 seconds, so wait more
|
|
time.sleep(121)
|
|
return {
|
|
"options": [
|
|
],
|
|
"rpcmethods": [
|
|
]
|
|
}
|
|
|
|
|
|
methods = {
|
|
'getmanifest': json_getmanifest,
|
|
}
|
|
|
|
|
|
partial = ""
|
|
for l in sys.stdin:
|
|
try:
|
|
partial += l
|
|
request = json.loads(partial)
|
|
except Exception:
|
|
continue
|
|
|
|
result = None
|
|
method = methods[request['method']]
|
|
params = request['params']
|
|
try:
|
|
if isinstance(params, dict):
|
|
result = method(request, **params)
|
|
else:
|
|
result = method(request, *params)
|
|
result = {
|
|
"jsonrpc": "2.0",
|
|
"result": result,
|
|
"id": request['id']
|
|
}
|
|
except Exception:
|
|
result = {
|
|
"jsonrpc": "2.0",
|
|
"error": "Error while processing {}".format(request['method']),
|
|
"id": request['id']
|
|
}
|
|
|
|
json.dump(result, fp=sys.stdout)
|
|
sys.stdout.write('\n')
|
|
sys.stdout.flush()
|
|
partial = ""
|