test(modules): test starting by default

This commit is contained in:
JianBo He 2021-04-12 18:48:56 +08:00
parent 49b7d870e0
commit d6bbfdcd51
2 changed files with 13 additions and 2 deletions

View File

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

View File

@ -127,6 +127,19 @@ t_modules_cmd(_) ->
"Module emqx_mod_presence unloaded successfully.\n"), "Module emqx_mod_presence unloaded successfully.\n"),
unmock_print(). 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() -> mock_print() ->
catch meck:unload(emqx_ctl), catch meck:unload(emqx_ctl),
meck:new(emqx_ctl, [non_strict, passthrough]), meck:new(emqx_ctl, [non_strict, passthrough]),