fix(emqx): avoid interference in testsuites

Also remove that `?wait_async_action` in `emqx_trace_SUITE` which
consistently becomes stuck for 100 seconds. It's not clear why it
was there in the first place because listeners should start
synchronously, so `emqx_common_test_helpers:start_apps/1` won't return
until required listeners are started.
This commit is contained in:
Andrew Mayorov 2023-06-02 22:21:33 +03:00
parent 8a31e5639b
commit 206d0472e0
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
3 changed files with 8 additions and 17 deletions

View File

@ -347,6 +347,7 @@ stop_apps(Apps, Opts) ->
ok = mria_mnesia:delete_schema(),
%% to avoid inter-suite flakiness
application:unset_env(emqx, init_config_load_done),
application:unset_env(emqx, boot_modules),
persistent_term:erase(?EMQX_AUTHENTICATION_SCHEMA_MODULE_PT_KEY),
case Opts of
#{erase_all_configs := false} ->

View File

@ -326,8 +326,7 @@ t_gc_active(_Config) ->
emqx_tls_certfile_gc:run()
)
after
emqx_common_test_helpers:stop_apps([]),
emqx_common_test_helpers:boot_modules(all)
emqx_common_test_helpers:stop_apps([])
end.
orphans() ->

View File

@ -33,21 +33,12 @@ all() ->
emqx_common_test_helpers:all(?MODULE).
init_per_suite(Config) ->
%% ensure dependent apps stopped
emqx_common_test_helpers:stop_apps([]),
?check_trace(
?wait_async_action(
emqx_common_test_helpers:start_apps([]),
#{?snk_kind := listener_started, bind := 1883},
timer:seconds(100)
),
fun(Trace) ->
ct:pal("listener start statuses: ~p", [
?of_kind([listener_started, listener_not_started], Trace)
]),
%% more than one listener
?assertMatch([_ | _], ?of_kind(listener_started, Trace))
end
ok = emqx_common_test_helpers:start_apps([]),
Listeners = emqx_listeners:list(),
ct:pal("emqx_listeners:list() = ~p~n", [Listeners]),
?assertMatch(
[_ | _],
[ID || {ID, #{running := true}} <- Listeners]
),
Config.