Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin_control: more descriptive key for 'plugin stop' result #3374

Merged
merged 1 commit into from
Dec 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lightningd/plugin_control.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <lightningd/options.h>
#include <lightningd/plugin_control.h>
#include <lightningd/plugin_hook.h>

Expand Down Expand Up @@ -206,7 +207,11 @@ plugin_dynamic_stop(struct command *cmd, const char *plugin_name)
plugin_kill(p, "%s stopped by lightningd via RPC", plugin_name);
tal_free(p);
response = json_stream_success(cmd);
json_add_string(response, "",
if (deprecated_apis)
json_add_string(response, "",
take(tal_fmt(NULL, "Successfully stopped %s.",
plugin_name)));
json_add_string(response, "result",
take(tal_fmt(NULL, "Successfully stopped %s.",
plugin_name)));
return command_success(cmd, response);
Expand Down
6 changes: 4 additions & 2 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ def test_plugin_command(node_factory):
n.rpc.plugin_list()

# Make sure the plugin behaves normally after stop and restart
assert("Successfully stopped helloworld.py." == n.rpc.plugin_stop(plugin="helloworld.py")[''])
assert("Successfully stopped helloworld.py."
== n.rpc.plugin_stop(plugin="helloworld.py")["result"])
n.daemon.wait_for_log(r"Killing plugin: helloworld.py")
n.rpc.plugin_start(plugin=os.path.join(os.getcwd(), "contrib/plugins/helloworld.py"))
n.daemon.wait_for_log(r"Plugin helloworld.py initialized")
assert("Hello world" == n.rpc.call(method="hello"))

# Now stop the helloworld plugin
assert("Successfully stopped helloworld.py." == n.rpc.plugin_stop(plugin="helloworld.py")[''])
assert("Successfully stopped helloworld.py."
== n.rpc.plugin_stop(plugin="helloworld.py")["result"])
n.daemon.wait_for_log(r"Killing plugin: helloworld.py")
# Make sure that the 'hello' command from the helloworld.py plugin
# is not available anymore.
Expand Down