From f062517ccb9339660a978fdca384c15ce36e8a5f Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Tue, 14 May 2024 17:11:05 -0300 Subject: [PATCH] test: stabilize flaky test --- apps/emqx/test/emqx_takeover_SUITE.erl | 35 ++++++++++++-------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/apps/emqx/test/emqx_takeover_SUITE.erl b/apps/emqx/test/emqx_takeover_SUITE.erl index 3303ab9b1..597274258 100644 --- a/apps/emqx/test/emqx_takeover_SUITE.erl +++ b/apps/emqx/test/emqx_takeover_SUITE.erl @@ -884,26 +884,23 @@ t_kick_session(Config) -> {will_qos, 1} ], Commands = - %% GIVEN: client connect with willmsg payload <<"willpayload_kick">> - [{fun start_client/5, [ClientId, ClientId, ?QOS_1, WillOpts]}] ++ - [ - {fun start_client/5, [ - <>/binary>>, WillTopic, ?QOS_1, [] - ]} - ] ++ - [ - %% kick may fail (not found) without this delay - { - fun(CTX) -> - timer:sleep(100), - CTX - end, - [] - } - ] ++ + lists:flatten([ + %% GIVEN: client connect with willmsg payload <<"willpayload_kick">> + {fun start_client/5, [ClientId, ClientId, ?QOS_1, WillOpts]}, + {fun start_client/5, [ + <>/binary>>, WillTopic, ?QOS_1, [] + ]}, + %% kick may fail (not found) without this delay + { + fun(CTX) -> + timer:sleep(300), + CTX + end, + [] + }, %% WHEN: client is kicked with kick_session - [{fun kick_client/2, [ClientId]}], - + {fun kick_client/2, [ClientId]} + ]), FCtx = lists:foldl( fun({Fun, Args}, Ctx) -> ct:pal("COMMAND: ~p ~p", [element(2, erlang:fun_info(Fun, name)), Args]),