testing: test that RPC calls made in shutdown fail and receive error code -5

and the two conditions in which plugins can receive shutdown notification
This commit is contained in:
Simon Vrouwe
2021-11-10 10:31:06 +02:00
committed by Rusty Russell
parent 0388314ef8
commit 89cbdf4dce
2 changed files with 26 additions and 2 deletions

View File

@@ -1086,7 +1086,7 @@ def test_htlc_accepted_hook_direct_restart(node_factory, executor):
def test_htlc_accepted_hook_shutdown(node_factory, executor):
"""Hooks of important-plugins are never removed and these plugins are kept
alive until after subdaemons are shutdown.
alive until after subdaemons are shutdown. Also tests shutdown notification.
"""
l1, l2 = node_factory.line_graph(2, opts=[
{'may_reconnect': True, 'log-level': 'info'},
@@ -1095,6 +1095,10 @@ def test_htlc_accepted_hook_shutdown(node_factory, executor):
'important-plugin': [os.path.join(os.getcwd(), 'tests/plugins/fail_htlcs.py')]}
])
l2.rpc.plugin_stop(os.path.join(os.getcwd(), 'tests/plugins/misc_notifications.py'))
l2.daemon.wait_for_log(r'datastore success')
l2.rpc.plugin_start(os.path.join(os.getcwd(), 'tests/plugins/misc_notifications.py'))
i1 = l2.rpc.invoice(msatoshi=1000, label="inv1", description="desc")['bolt11']
# fail_htlcs.py makes payment fail
@@ -1107,6 +1111,8 @@ def test_htlc_accepted_hook_shutdown(node_factory, executor):
# Should still fail htlc while shutting down
with pytest.raises(RpcError):
l1.rpc.pay(i1)
l2.daemon.wait_for_log(r'datastore failed')
f_stop.result()