فهرست منبع

test(modules): test starting by default

JianBo He 4 سال پیش
والد
کامیت
d6bbfdcd51
2فایلهای تغییر یافته به همراه13 افزوده شده و 2 حذف شده
  1. 0 2
      lib-ce/emqx_modules/test/emqx_mod_sup_SUITE.erl
  2. 13 0
      lib-ce/emqx_modules/test/emqx_modules_SUITE.erl

+ 0 - 2
lib-ce/emqx_modules/test/emqx_mod_sup_SUITE.erl

@@ -28,7 +28,6 @@ all() -> emqx_ct:all(?MODULE).
 %%--------------------------------------------------------------------
 
 t_start(_) ->
-    {ok, _} = emqx_mod_sup:start_link(),
     ?assertEqual([], supervisor:which_children(emqx_mod_sup)).
 
 t_start_child(_) ->
@@ -41,7 +40,6 @@ t_start_child(_) ->
              type => worker,
              modules => [Mod]},
 
-    {ok, _} = emqx_mod_sup:start_link(),
     ok  = emqx_mod_sup:start_child(Mod, worker),
     ?assertError({already_started, _}, emqx_mod_sup:start_child(Spec)),
 

+ 13 - 0
lib-ce/emqx_modules/test/emqx_modules_SUITE.erl

@@ -127,6 +127,19 @@ t_modules_cmd(_) ->
                  "Module emqx_mod_presence unloaded successfully.\n"),
     unmock_print().
 
+%% For: https://github.com/emqx/emqx/issues/4511
+t_join_cluster(_) ->
+    %% Started by emqx application
+    {error, {already_started, emqx_modules}} = application:start(emqx_modules),
+    %% After clustered
+    emqx:shutdown(),
+    emqx:reboot(),
+    {error,{already_started,emqx_modules}} = application:start(emqx_modules),
+    %% After emqx reboot, we should not interfere with other tests
+    _ = end_per_suite([]),
+    _ = init_per_suite([]),
+    ok.
+
 mock_print() ->
     catch meck:unload(emqx_ctl),
     meck:new(emqx_ctl, [non_strict, passthrough]),