Skip to content

Commit

Permalink
test(autoheal): verify crashes are now tolerated
Browse files Browse the repository at this point in the history
  • Loading branch information
keynslug committed Dec 13, 2024
1 parent 659e6dc commit 8edf5d0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/ekka_autoheal_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

-module(ekka_autoheal_SUITE).

-include_lib("snabbkaffe/include/test_macros.hrl").

-compile(export_all).
-compile(nowarn_export_all).

Expand All @@ -36,6 +38,7 @@ t_enabled(_Config) ->
{true, 2000} = ekka_autoheal:enabled().

t_autoheal(_Config) ->
ok = snabbkaffe:start_trace(),
[N1,N2,N3] = Nodes = lists:map(fun start_slave_node/1, [n1,n2,n3]),
try
%% Create cluster
Expand All @@ -52,6 +55,12 @@ t_autoheal(_Config) ->
[N3] = rpc:call(N2, ekka, info, [stopped_nodes]),
[N3] = rpc:call(N3, ekka, info, [running_nodes]),
[N1,N2] = rpc:call(N3, ekka, info, [stopped_nodes]),
%% Simulate autoheal crash, to verify autoheal tolerates it.
_Ref = snabbkaffe_nemesis:inject_crash(
?match_event(#{?snk_kind := start_heal_partition}),
fun(N) -> N < 2 end,
?MODULE
),
%% Wait for autoheal
ok = timer:sleep(12000),
[N1,N2,N3] = rpc:call(N1, ekka, info, [running_nodes]),
Expand All @@ -61,7 +70,8 @@ t_autoheal(_Config) ->
rpc:call(N2, ekka, leave, []),
rpc:call(N3, ekka, leave, [])
after
lists:foreach(fun ekka_ct:stop_slave/1, Nodes)
lists:foreach(fun ekka_ct:stop_slave/1, Nodes),
snabbkaffe:stop()
end.

t_autoheal_asymm(_Config) ->
Expand Down

0 comments on commit 8edf5d0

Please sign in to comment.