Fix returned value of plugin reloading (#3126)
This commit is contained in:
parent
9786dd5305
commit
116c593178
|
@ -261,8 +261,6 @@ node.fullsweep_after = 1000
|
||||||
## Value: Log file
|
## Value: Log file
|
||||||
node.crash_dump = {{ platform_log_dir }}/crash.dump
|
node.crash_dump = {{ platform_log_dir }}/crash.dump
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Specify SSL Options in the file if using SSL for Erlang Distribution.
|
## Specify SSL Options in the file if using SSL for Erlang Distribution.
|
||||||
##
|
##
|
||||||
## Value: File
|
## Value: File
|
||||||
|
|
|
@ -213,7 +213,7 @@ start_app(App, SuccFun) ->
|
||||||
?LOG(info, "Started plugins: ~p", [Started]),
|
?LOG(info, "Started plugins: ~p", [Started]),
|
||||||
?LOG(info, "Load plugin ~s successfully", [App]),
|
?LOG(info, "Load plugin ~s successfully", [App]),
|
||||||
SuccFun(App),
|
SuccFun(App),
|
||||||
{ok, Started};
|
ok;
|
||||||
{error, {ErrApp, Reason}} ->
|
{error, {ErrApp, Reason}} ->
|
||||||
?LOG(error, "Load plugin ~s failed, cannot start plugin ~s for ~p", [App, ErrApp, Reason]),
|
?LOG(error, "Load plugin ~s failed, cannot start plugin ~s for ~p", [App, ErrApp, Reason]),
|
||||||
{error, {ErrApp, Reason}}
|
{error, {ErrApp, Reason}}
|
||||||
|
|
|
@ -59,7 +59,7 @@ t_load(_) ->
|
||||||
?assertEqual([], emqx_plugins:unload()),
|
?assertEqual([], emqx_plugins:unload()),
|
||||||
|
|
||||||
?assertEqual({error, not_found}, emqx_plugins:load(not_existed_plugin)),
|
?assertEqual({error, not_found}, emqx_plugins:load(not_existed_plugin)),
|
||||||
?assertMatch({ok, _}, emqx_plugins:load(emqx_mini_plugin)),
|
?assertMatch(ok, emqx_plugins:load(emqx_mini_plugin)),
|
||||||
?assertEqual({error, already_started}, emqx_plugins:load(emqx_mini_plugin)),
|
?assertEqual({error, already_started}, emqx_plugins:load(emqx_mini_plugin)),
|
||||||
?assertEqual(ok, emqx_plugins:unload(emqx_mini_plugin)),
|
?assertEqual(ok, emqx_plugins:unload(emqx_mini_plugin)),
|
||||||
?assertEqual({error, not_started}, emqx_plugins:unload(emqx_mini_plugin)),
|
?assertEqual({error, not_started}, emqx_plugins:unload(emqx_mini_plugin)),
|
||||||
|
@ -127,7 +127,7 @@ t_load_plugin(_) ->
|
||||||
(App) -> {ok, App} end),
|
(App) -> {ok, App} end),
|
||||||
|
|
||||||
?assertMatch({error, _}, emqx_plugins:load_plugin(#plugin{name = already_loaded_app}, true)),
|
?assertMatch({error, _}, emqx_plugins:load_plugin(#plugin{name = already_loaded_app}, true)),
|
||||||
?assertMatch({ok, _}, emqx_plugins:load_plugin(#plugin{name = normal}, true)),
|
?assertMatch(ok, emqx_plugins:load_plugin(#plugin{name = normal}, true)),
|
||||||
?assertMatch({error,_}, emqx_plugins:load_plugin(#plugin{name = error_app}, true)),
|
?assertMatch({error,_}, emqx_plugins:load_plugin(#plugin{name = error_app}, true)),
|
||||||
|
|
||||||
ok = meck:unload(application).
|
ok = meck:unload(application).
|
||||||
|
|
Loading…
Reference in New Issue