test 'shutdown' notifications, via `plugin stop` or via `stop`
(node_factory)
| 3147 | |
| 3148 | |
| 3149 | def test_plugin_shutdown(node_factory): |
| 3150 | """test 'shutdown' notifications, via `plugin stop` or via `stop`""" |
| 3151 | |
| 3152 | p = os.path.join(os.getcwd(), "tests/plugins/test_libplugin") |
| 3153 | p2 = os.path.join(os.getcwd(), 'tests/plugins/misc_notifications.py') |
| 3154 | l1 = node_factory.get_node(options={'plugin': [p, p2]}) |
| 3155 | |
| 3156 | l1.rpc.plugin_stop(p) |
| 3157 | l1.daemon.wait_for_log(r"test_libplugin: shutdown called") |
| 3158 | # FIXME: clean this up! |
| 3159 | l1.daemon.wait_for_log(r"test_libplugin: Killing plugin: exited during normal operation") |
| 3160 | |
| 3161 | # Via `plugin stop` it can make RPC calls before it (self-)terminates |
| 3162 | l1.rpc.plugin_stop(p2) |
| 3163 | l1.daemon.wait_for_log(r'misc_notifications.py: via plugin stop, datastore success') |
| 3164 | l1.rpc.plugin_start(p2) |
| 3165 | |
| 3166 | # Now try timeout via `plugin stop` |
| 3167 | l1.rpc.plugin_start(p, dont_shutdown=True) |
| 3168 | l1.rpc.plugin_stop(p) |
| 3169 | l1.daemon.wait_for_log(r"test_libplugin: shutdown called") |
| 3170 | l1.daemon.wait_for_log(r"test_libplugin: Timeout on shutdown: killing anyway") |
| 3171 | |
| 3172 | # Now, should also shutdown or timeout on finish, RPC calls then fail with error code -5 |
| 3173 | l1.rpc.plugin_start(p, dont_shutdown=True) |
| 3174 | l1.rpc.stop() |
| 3175 | l1.daemon.wait_for_logs(['test_libplugin: shutdown called', |
| 3176 | 'misc_notifications.py: .* Connection refused', |
| 3177 | 'test_libplugin: failed to self-terminate in time, killing.']) |
| 3178 | |
| 3179 | |
| 3180 | def test_commando(node_factory, executor): |
nothing calls this directly
no test coverage detected