浏览代码

Fix returned value of plugin reloading (#3126)

tigercl 6 年之前
父节点
当前提交
116c593178
共有 3 个文件被更改,包括 3 次插入5 次删除
  1. 0 2
      etc/emqx.conf
  2. 1 1
      src/emqx_plugins.erl
  3. 2 2
      test/emqx_plugins_SUITE.erl

+ 0 - 2
etc/emqx.conf

@@ -261,8 +261,6 @@ node.fullsweep_after = 1000
 ## Value: Log file
 node.crash_dump = {{ platform_log_dir }}/crash.dump
 
-
-
 ## Specify SSL Options in the file if using SSL for Erlang Distribution.
 ##
 ## Value: File

+ 1 - 1
src/emqx_plugins.erl

@@ -213,7 +213,7 @@ start_app(App, SuccFun) ->
             ?LOG(info, "Started plugins: ~p", [Started]),
             ?LOG(info, "Load plugin ~s successfully", [App]),
             SuccFun(App),
-            {ok, Started};
+            ok;
         {error, {ErrApp, Reason}} ->
             ?LOG(error, "Load plugin ~s failed, cannot start plugin ~s for ~p", [App, ErrApp, Reason]),
             {error, {ErrApp, Reason}}

+ 2 - 2
test/emqx_plugins_SUITE.erl

@@ -59,7 +59,7 @@ t_load(_) ->
     ?assertEqual([], emqx_plugins:unload()),
 
     ?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(ok, 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),
 
     ?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)),
 
     ok = meck:unload(application).