test: add more context to help debug flaky test
Ex: https://github.com/emqx/emqx/actions/runs/9084293110/job/24967912514?pr=13050#step:6:18330
This commit is contained in:
parent
202e145db7
commit
b0aa7f25aa
|
@ -45,6 +45,10 @@
|
|||
).
|
||||
|
||||
-define(assertReceive(PATTERN, TIMEOUT),
|
||||
?assertReceive(PATTERN, TIMEOUT, #{})
|
||||
).
|
||||
|
||||
-define(assertReceive(PATTERN, TIMEOUT, EXTRA),
|
||||
(fun() ->
|
||||
receive
|
||||
X__V = PATTERN -> X__V
|
||||
|
@ -54,7 +58,8 @@
|
|||
{module, ?MODULE},
|
||||
{line, ?LINE},
|
||||
{expression, (??PATTERN)},
|
||||
{mailbox, ?drainMailbox()}
|
||||
{mailbox, ?drainMailbox()},
|
||||
{extra_info, EXTRA}
|
||||
]}
|
||||
)
|
||||
end
|
||||
|
|
|
@ -1045,9 +1045,9 @@ assert_client_exit(Pid, v5, takenover) ->
|
|||
%% @ref: MQTT 5.0 spec [MQTT-3.1.4-3]
|
||||
?assertReceive({'EXIT', Pid, {disconnected, ?RC_SESSION_TAKEN_OVER, _}});
|
||||
assert_client_exit(Pid, v3, takenover) ->
|
||||
?assertReceive({'EXIT', Pid, {shutdown, tcp_closed}});
|
||||
?assertReceive({'EXIT', Pid, {shutdown, tcp_closed}}, 1_000, #{pid => Pid});
|
||||
assert_client_exit(Pid, v3, kicked) ->
|
||||
?assertReceive({'EXIT', Pid, _});
|
||||
?assertReceive({'EXIT', Pid, _}, 1_000, #{pid => Pid});
|
||||
assert_client_exit(Pid, v5, kicked) ->
|
||||
?assertReceive({'EXIT', Pid, {disconnected, ?RC_ADMINISTRATIVE_ACTION, _}});
|
||||
assert_client_exit(Pid, _, killed) ->
|
||||
|
|
Loading…
Reference in New Issue