Sfoglia il codice sorgente

test: fix flaky test emqx_falpping_SUITE:t_conf_update_timer

Zaiming (Stone) Shi 2 anni fa
parent
commit
99b60849b4

+ 8 - 0
apps/emqx/src/emqx_cm_sup.erl

@@ -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.

+ 3 - 1
apps/emqx/test/emqx_flapping_SUITE.erl

@@ -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, _} =

+ 1 - 1
apps/emqx_bridge_kafka/test/emqx_bridge_kafka_impl_producer_SUITE.erl

@@ -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").