test: fix flaky

This commit is contained in:
JimMoen 2024-03-12 10:30:13 +08:00
parent c0552d8877
commit 0edeff4786
No known key found for this signature in database
3 changed files with 5 additions and 3 deletions

View File

@ -78,7 +78,8 @@ handle_call({cpu_util, Args}, _From, State) ->
Val = erlang:apply(cpu_sup, util, Args), Val = erlang:apply(cpu_sup, util, Args),
{reply, Val, State}; {reply, Val, State};
handle_call(Req, _From, State) -> handle_call(Req, _From, State) ->
{reply, {error, {unexpected_call, Req}}, State}. ?SLOG(error, #{msg => "unexpected_call", call => Req}),
{reply, ignored, State}.
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?SLOG(error, #{msg => "unexpected_cast", cast => Msg}), ?SLOG(error, #{msg => "unexpected_cast", cast => Msg}),

View File

@ -28,7 +28,7 @@ start_link() ->
init([]) -> init([]) ->
OsMon = OsMon =
case emqx_os_mon:is_os_check_supported() of case emqx_os_mon:is_os_check_supported() of
true -> [child_spec(emqx_cpu_sup_worker), child_spec(emqx_os_mon)]; true -> [child_spec(emqx_os_mon), child_spec(emqx_cpu_sup_worker)];
false -> [] false -> []
end, end,
Children = Children =

View File

@ -132,7 +132,8 @@ do_sys_mem_check_alarm(_Config) ->
get_memory_usage, get_memory_usage,
fun() -> Mem end, fun() -> Mem end,
fun() -> fun() ->
timer:sleep(500), %% wait for `os_mon` started
timer:sleep(10_000),
Alarms = emqx_alarm:get_alarms(activated), Alarms = emqx_alarm:get_alarms(activated),
?assert( ?assert(
emqx_vm_mon_SUITE:is_existing( emqx_vm_mon_SUITE:is_existing(