test(refactor): decrease test teardown noise

This commit is contained in:
Thales Macedo Garitezi 2022-12-16 17:18:40 -03:00
parent 6fdcba641e
commit 4819794401
2 changed files with 10 additions and 1 deletions

View File

@ -65,7 +65,8 @@
-export([clear_screen/0]). -export([clear_screen/0]).
-export([with_mock/4]). -export([with_mock/4]).
-export([ -export([
on_exit/1 on_exit/1,
call_janitor/0
]). ]).
%% Toxiproxy API %% Toxiproxy API
@ -933,6 +934,13 @@ latency_up_proxy(off, Name, ProxyHost, ProxyPort) ->
%% Testcase teardown utilities %% Testcase teardown utilities
%%------------------------------------------------------------------------------- %%-------------------------------------------------------------------------------
%% stop the janitor gracefully to ensure proper cleanup order and less
%% noise in the logs.
call_janitor() ->
Janitor = get_or_spawn_janitor(),
exit(Janitor, normal),
ok.
get_or_spawn_janitor() -> get_or_spawn_janitor() ->
case get({?MODULE, janitor_proc}) of case get({?MODULE, janitor_proc}) of
undefined -> undefined ->

View File

@ -139,6 +139,7 @@ end_per_testcase(_TestCase, _Config) ->
ok = snabbkaffe:stop(), ok = snabbkaffe:stop(),
delete_all_bridges(), delete_all_bridges(),
ok = emqx_connector_web_hook_server:stop(), ok = emqx_connector_web_hook_server:stop(),
emqx_common_test_helpers:call_janitor(),
ok. ok.
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------