فهرست منبع

Start emqx-modules application by default (#4518)

* fix(modules): start emqx_modules by default

* chore(test): eliminate some compile warnings
JianBo He 4 سال پیش
والد
کامیت
16c999ed9b

+ 1 - 0
apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE.erl

@@ -17,6 +17,7 @@
 -module(emqx_auth_pgsql_SUITE).
 
 -compile(export_all).
+-compile(nowarn_export_all).
 
 -define(POOL, emqx_auth_pgsql).
 

+ 1 - 0
apps/emqx_auth_redis/test/emqx_auth_redis_SUITE.erl

@@ -17,6 +17,7 @@
 -module(emqx_auth_redis_SUITE).
 
 -compile(export_all).
+-compile(nowarn_export_all).
 
 -include_lib("emqx/include/emqx.hrl").
 

+ 0 - 17
apps/emqx_web_hook/test/props/prop_webhook_hooks.erl

@@ -325,9 +325,6 @@ peer2addr({Host, _}) ->
 peer2addr(Host) ->
     list_to_binary(inet:ntoa(Host)).
 
-ensure_to_binary(Atom) when is_atom(Atom) -> atom_to_binary(Atom, utf8);
-ensure_to_binary(Bin) when is_binary(Bin) -> Bin.
-
 stringfy({shutdown, Reason}) ->
     stringfy(Reason);
 stringfy(Term) when is_atom(Term); is_binary(Term) ->
@@ -343,17 +340,6 @@ receive_http_request_body() ->
         exit(waiting_message_timeout)
     end.
 
-receive_http_request_bodys() ->
-    receive_http_request_bodys_([]).
-
-receive_http_request_bodys_(Acc) ->
-    receive
-        {post, _, _, Body} ->
-           receive_http_request_bodys_([Body|Acc])
-    after 1000 ->
-          lists:reverse(Acc)
-    end.
-
 filter_topictab(TopicTab, {undefined}) ->
     TopicTab;
 filter_topictab(TopicTab, {TopicFilter}) ->
@@ -399,9 +385,6 @@ topic_filter_env() ->
 payload_encode() ->
     oneof([base62, base64, undefined]).
 
-http_code() ->
-    oneof([socket_closed_remotely, others]).
-
 disconnected_conninfo() ->
     ?LET(Info, conninfo(),
          begin

+ 1 - 1
lib-ce/emqx_telemetry/src/emqx_telemetry.app.src

@@ -3,7 +3,7 @@
   {vsn, "4.3.0"}, % strict semver, bump manually!
   {modules, []},
   {registered, [emqx_telemetry_sup]},
-  {applications, [kernel,stdlib,emqx_modules]},
+  {applications, [kernel,stdlib]},
   {mod, {emqx_telemetry_app,[]}},
   {env, []},
   {licenses, ["Apache-2.0"]},

+ 12 - 2
src/emqx.erl

@@ -234,10 +234,20 @@ shutdown(Reason) ->
     ?LOG(critical, "emqx shutdown for ~s", [Reason]),
     _ = emqx_alarm_handler:unload(),
     _ = emqx_plugins:unload(),
-    lists:foreach(fun application:stop/1, [emqx, ekka, cowboy, ranch, esockd, gproc]).
+    lists:foreach(fun application:stop/1
+                 , lists:reverse(default_started_applications())
+                 ).
 
 reboot() ->
-    lists:foreach(fun application:start/1, [gproc, esockd, ranch, cowboy, ekka, emqx]).
+    lists:foreach(fun application:start/1 , default_started_applications()).
+
+-ifdef(EMQX_ENTERPRISE).
+default_started_applications() ->
+    [gproc, esockd, ranch, cowboy, ekka, emqx].
+-else.
+default_started_applications() ->
+    [gproc, esockd, ranch, cowboy, ekka, emqx, emqx_modules].
+-endif.
 
 %%--------------------------------------------------------------------
 %% Internal functions

+ 1 - 2
test/emqx_ws_connection_SUITE.erl

@@ -86,8 +86,7 @@ init_per_testcase(TestCase, Config) when
 init_per_testcase(_, Config) ->
     Config.
 
-
-end_per_testcase(TestCase, Config) when
+end_per_testcase(TestCase, _Config) when
         TestCase =/= t_ws_sub_protocols_mqtt_equivalents,
         TestCase =/= t_ws_sub_protocols_mqtt,
         TestCase =/= t_ws_check_origin,