test: fix flaky test emqx_falpping_SUITE:t_conf_update_timer

This commit is contained in:
Zaiming (Stone) Shi 2023-09-18 20:44:38 +02:00
parent d1e5b69eac
commit 99b60849b4
3 changed files with 12 additions and 2 deletions

View File

@ -22,6 +22,9 @@
-export([init/1]).
%% for test
-export([restart_flapping/0]).
%%--------------------------------------------------------------------
%% API
%%--------------------------------------------------------------------
@ -59,3 +62,8 @@ child_spec(Mod, Shutdown, Type) ->
type => Type,
modules => [Mod]
}.
restart_flapping() ->
ok = supervisor:terminate_child(?MODULE, emqx_flapping),
{ok, _} = supervisor:restart_child(?MODULE, emqx_flapping),
ok.

View File

@ -133,7 +133,9 @@ t_conf_update(_) ->
ok.
t_conf_update_timer(_Config) ->
_ = emqx_flapping:start_link(),
%% delete all zones
?assertMatch({ok, _}, emqx:update_config([zones], #{})),
emqx_cm_sup:restart_flapping(),
validate_timer([{default, true}]),
%% change zones
{ok, _} =

View File

@ -29,7 +29,7 @@
-include_lib("eunit/include/eunit.hrl").
-include_lib("emqx/include/emqx.hrl").
-include("emqx_dashboard.hrl").
-include_lib("emqx_dashboard/include/emqx_dashboard.hrl").
-define(HOST, "http://127.0.0.1:18083").