fix(flaky_test): improve live connection count test on CI

It seems that a race condition that is triggered more often in CI can
make the test fail, possibly due to the ETS write not being seen by
the subsequent read in the test.
This commit is contained in:
Thales Macedo Garitezi 2021-11-22 09:29:43 -03:00
parent c137c2eab5
commit 8cdb5afb66
No known key found for this signature in database
GPG Key ID: DD279F8152A9B6DD
1 changed files with 2 additions and 0 deletions

View File

@ -479,6 +479,7 @@ t_connected_client_stats(Config) when is_list(Config) ->
fun() -> emqtt:ConnFun(ConnPid) end, fun() -> emqtt:ConnFun(ConnPid) end,
[emqx_cm_connected_client_count_inc] [emqx_cm_connected_client_count_inc]
), ),
timer:sleep(20),
%% ensure stats are synchronized %% ensure stats are synchronized
{_, {ok, [_]}} = wait_for_stats( {_, {ok, [_]}} = wait_for_stats(
fun emqx_cm:stats_fun/0, fun emqx_cm:stats_fun/0,
@ -491,6 +492,7 @@ t_connected_client_stats(Config) when is_list(Config) ->
fun() -> emqtt:disconnect(ConnPid) end, fun() -> emqtt:disconnect(ConnPid) end,
[emqx_cm_connected_client_count_dec] [emqx_cm_connected_client_count_dec]
), ),
timer:sleep(20),
%% ensure stats are synchronized %% ensure stats are synchronized
{_, {ok, [_]}} = wait_for_stats( {_, {ok, [_]}} = wait_for_stats(
fun emqx_cm:stats_fun/0, fun emqx_cm:stats_fun/0,