fix(test): fix flaky test
This commit is contained in:
parent
c0d2243e72
commit
f425665449
|
@ -158,14 +158,16 @@ auth_header_() ->
|
||||||
{"Authorization", "Basic " ++ Basic}.
|
{"Authorization", "Basic " ++ Basic}.
|
||||||
|
|
||||||
restart_monitor() ->
|
restart_monitor() ->
|
||||||
erlang:exit(erlang:whereis(emqx_dashboard_monitor), killed),
|
OldMonitor = erlang:whereis(emqx_dashboard_monitor),
|
||||||
?assertEqual(ok, wait_new_monitor(10)).
|
erlang:exit(OldMonitor, killed),
|
||||||
|
?assertEqual(ok, wait_new_monitor(OldMonitor, 10)).
|
||||||
|
|
||||||
wait_new_monitor(Count) when Count =< 0 -> timeout;
|
wait_new_monitor(_OldMonitor, Count) when Count =< 0 -> timeout;
|
||||||
wait_new_monitor(Count) ->
|
wait_new_monitor(OldMonitor, Count) ->
|
||||||
case is_pid(erlang:whereis(emqx_dashboard_monitor)) of
|
NewMonitor = erlang:whereis(emqx_dashboard_monitor),
|
||||||
|
case is_pid(NewMonitor) andalso NewMonitor =/= OldMonitor of
|
||||||
true -> ok;
|
true -> ok;
|
||||||
false ->
|
false ->
|
||||||
timer:sleep(100),
|
timer:sleep(100),
|
||||||
wait_new_monitor(Count - 1)
|
wait_new_monitor(OldMonitor, Count - 1)
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue