test(flaky): more adjustments

This commit is contained in:
Thales Macedo Garitezi 2023-11-27 14:45:18 -03:00
parent e3fbf6c958
commit bd40b5c553
2 changed files with 23 additions and 7 deletions

View File

@ -478,7 +478,6 @@ do_pull_async(State0) ->
Body = body(State0, pull), Body = body(State0, pull),
PreparedRequest = {prepared_request, {Method, Path, Body}}, PreparedRequest = {prepared_request, {Method, Path, Body}},
ReplyFunAndArgs = {fun ?MODULE:reply_delegator/4, [self(), pull_async, InstanceId]}, ReplyFunAndArgs = {fun ?MODULE:reply_delegator/4, [self(), pull_async, InstanceId]},
%% `ehttpc_pool'/`gproc_pool' might return `false' if there are no workers...
Res = emqx_bridge_gcp_pubsub_client:query_async( Res = emqx_bridge_gcp_pubsub_client:query_async(
PreparedRequest, PreparedRequest,
ReplyFunAndArgs, ReplyFunAndArgs,

View File

@ -512,10 +512,16 @@ wait_acked(Opts) ->
%% no need to check return value; we check the property in %% no need to check return value; we check the property in
%% the check phase. this is just to give it a chance to do %% the check phase. this is just to give it a chance to do
%% so and avoid flakiness. should be fast. %% so and avoid flakiness. should be fast.
snabbkaffe:block_until( Res = snabbkaffe:block_until(
?match_n_events(N, #{?snk_kind := gcp_pubsub_consumer_worker_acknowledged}), ?match_n_events(N, #{?snk_kind := gcp_pubsub_consumer_worker_acknowledged}),
Timeout Timeout
), ),
case Res of
{ok, _} ->
ok;
{timeout, Evts} ->
ct:pal("timed out waiting for acks; received:\n ~p", [Evts])
end,
ok. ok.
wait_forgotten() -> wait_forgotten() ->
@ -1270,7 +1276,7 @@ t_multiple_pull_workers(Config) ->
}, },
<<"resource_opts">> => #{ <<"resource_opts">> => #{
%% reduce flakiness %% reduce flakiness
<<"request_ttl">> => <<"4s">> <<"request_ttl">> => <<"11s">>
} }
} }
), ),
@ -1532,11 +1538,12 @@ t_async_worker_death_mid_pull(Config) ->
ct:pal("published message"), ct:pal("published message"),
AsyncWorkerPids = get_async_worker_pids(Config), AsyncWorkerPids = get_async_worker_pids(Config),
Timeout = 20_000,
emqx_utils:pmap( emqx_utils:pmap(
fun(AsyncWorkerPid) -> fun(AsyncWorkerPid) ->
Ref = monitor(process, AsyncWorkerPid), Ref = monitor(process, AsyncWorkerPid),
ct:pal("killing pid ~p", [AsyncWorkerPid]), ct:pal("killing pid ~p", [AsyncWorkerPid]),
sys:terminate(AsyncWorkerPid, die, 20_000), sys:terminate(AsyncWorkerPid, die, Timeout),
receive receive
{'DOWN', Ref, process, AsyncWorkerPid, _} -> {'DOWN', Ref, process, AsyncWorkerPid, _} ->
ct:pal("killed pid ~p", [AsyncWorkerPid]), ct:pal("killed pid ~p", [AsyncWorkerPid]),
@ -1545,7 +1552,8 @@ t_async_worker_death_mid_pull(Config) ->
end, end,
ok ok
end, end,
AsyncWorkerPids AsyncWorkerPids,
Timeout + 2_000
), ),
ok ok
@ -1559,7 +1567,13 @@ t_async_worker_death_mid_pull(Config) ->
?wait_async_action( ?wait_async_action(
create_bridge( create_bridge(
Config, Config,
#{<<"pool_size">> => 1} #{
<<"pool_size">> => 1,
<<"consumer">> => #{
<<"ack_deadline">> => <<"10s">>,
<<"ack_retry_interval">> => <<"1s">>
}
}
), ),
#{?snk_kind := gcp_pubsub_consumer_worker_init}, #{?snk_kind := gcp_pubsub_consumer_worker_init},
10_000 10_000
@ -2032,7 +2046,10 @@ t_connection_down_during_pull(Config) ->
?wait_async_action( ?wait_async_action(
create_bridge( create_bridge(
Config, Config,
#{<<"consumer">> => #{<<"ack_retry_interval">> => <<"1s">>}} #{
<<"consumer">> => #{<<"ack_retry_interval">> => <<"1s">>},
<<"resource_opts">> => #{<<"request_ttl">> => <<"11s">>}
}
), ),
#{?snk_kind := "gcp_pubsub_consumer_worker_subscription_ready"}, #{?snk_kind := "gcp_pubsub_consumer_worker_subscription_ready"},
10_000 10_000