test(peer): increase init and startup timeout for peer nodes

Attempt to stabilize tests that use cluster nodes.
This commit is contained in:
Thales Macedo Garitezi 2023-03-31 11:02:15 -03:00
parent 0e5a22f500
commit 8b5a717a1f
2 changed files with 16 additions and 10 deletions

View File

@ -660,6 +660,7 @@ start_slave(Name, Opts) when is_list(Opts) ->
start_slave(Name, Opts) when is_map(Opts) ->
SlaveMod = maps:get(peer_mod, Opts, ct_slave),
Node = node_name(Name),
put_peer_mod(Node, SlaveMod),
DoStart =
fun() ->
case SlaveMod of
@ -669,8 +670,8 @@ start_slave(Name, Opts) when is_map(Opts) ->
[
{kill_if_fail, true},
{monitor_master, true},
{init_timeout, 10000},
{startup_timeout, 10000},
{init_timeout, 20_000},
{startup_timeout, 20_000},
{erl_flags, erl_flags()}
]
);
@ -687,7 +688,6 @@ start_slave(Name, Opts) when is_map(Opts) ->
throw(Other)
end,
pong = net_adm:ping(Node),
put_peer_mod(Node, SlaveMod),
setup_node(Node, Opts),
ok = snabbkaffe:forward_trace(Node),
Node.

View File

@ -388,7 +388,9 @@ end_per_testcase(_Testcase, Config) ->
maps:values(ProducersMapping)
),
ok = wolff:stop_and_delete_supervised_client(KafkaProducerClientId),
emqx_common_test_helpers:call_janitor(30_000),
%% in CI, apparently this needs more time since the
%% machines struggle with all the containers running...
emqx_common_test_helpers:call_janitor(60_000),
ok = snabbkaffe:stop(),
ok
end.
@ -1664,7 +1666,7 @@ t_cluster_group(Config) ->
|| {Name, Opts} <- Cluster
],
on_exit(fun() ->
lists:foreach(
emqx_misc:pmap(
fun(N) ->
ct:pal("stopping ~p", [N]),
ok = emqx_common_test_helpers:stop_slave(N)
@ -1875,7 +1877,7 @@ t_cluster_node_down(Config) ->
Cluster
),
on_exit(fun() ->
lists:foreach(
emqx_misc:pmap(
fun(N) ->
ct:pal("stopping ~p", [N]),
ok = emqx_common_test_helpers:stop_slave(N)
@ -1894,10 +1896,14 @@ t_cluster_node_down(Config) ->
{ok, _} = snabbkaffe:receive_events(SRef0),
lists:foreach(
fun(N) ->
?assertMatch(
{ok, _},
erpc:call(N, emqx_bridge, lookup, [BridgeId]),
#{node => N}
?retry(
_Sleep1 = 100,
_Attempts1 = 50,
?assertMatch(
{ok, _},
erpc:call(N, emqx_bridge, lookup, [BridgeId]),
#{node => N}
)
)
end,
Nodes