ci(test): add info to help diagnose flaky test

This commit is contained in:
Thales Macedo Garitezi 2023-11-22 12:36:10 -03:00
parent e065217e9a
commit fc849f0c05
1 changed files with 8 additions and 2 deletions

View File

@ -1494,10 +1494,11 @@ t_pull_worker_death(Config) ->
ok. ok.
t_async_worker_death_mid_pull(Config) -> t_async_worker_death_mid_pull(Config) ->
ct:timetrap({seconds, 120}), ct:timetrap({seconds, 122}),
[#{pubsub_topic := PubSubTopic}] = ?config(topic_mapping, Config), [#{pubsub_topic := PubSubTopic}] = ?config(topic_mapping, Config),
Payload = emqx_guid:to_hexstr(emqx_guid:gen()), Payload = emqx_guid:to_hexstr(emqx_guid:gen()),
?check_trace( ?check_trace(
#{timetrap => 120_000},
begin begin
start_and_subscribe_mqtt(Config), start_and_subscribe_mqtt(Config),
@ -1513,18 +1514,22 @@ t_async_worker_death_mid_pull(Config) ->
#{?snk_kind := gcp_pubsub_consumer_worker_reply_delegator} #{?snk_kind := gcp_pubsub_consumer_worker_reply_delegator}
), ),
spawn_link(fun() -> spawn_link(fun() ->
ct:pal("will kill async worker"),
?tp_span( ?tp_span(
kill_async_worker, kill_async_worker,
#{}, #{},
begin begin
%% produce a message while worker is being killed %% produce a message while worker is being killed
Messages = [#{<<"data">> => Payload}], Messages = [#{<<"data">> => Payload}],
ct:pal("publishing message"),
pubsub_publish(Config, PubSubTopic, Messages), pubsub_publish(Config, PubSubTopic, Messages),
ct:pal("published message"),
AsyncWorkerPids = get_async_worker_pids(Config), AsyncWorkerPids = get_async_worker_pids(Config),
emqx_utils:pmap( emqx_utils:pmap(
fun(AsyncWorkerPid) -> fun(AsyncWorkerPid) ->
Ref = monitor(process, AsyncWorkerPid), Ref = monitor(process, AsyncWorkerPid),
ct:pal("killing pid ~p", [AsyncWorkerPid]),
sys:terminate(AsyncWorkerPid, die), sys:terminate(AsyncWorkerPid, die),
receive receive
{'DOWN', Ref, process, AsyncWorkerPid, _} -> {'DOWN', Ref, process, AsyncWorkerPid, _} ->
@ -1538,7 +1543,8 @@ t_async_worker_death_mid_pull(Config) ->
ok ok
end end
) ),
ct:pal("killed async worker")
end), end),
?assertMatch( ?assertMatch(