Skip to content

Commit

Permalink
Add pause_on_remote_crashes testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
arcusfelis committed Dec 24, 2023
1 parent 543526d commit bf92967
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test/cets_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ seq_cases() ->
pre_connect_fails_on_our_node,
pre_connect_fails_on_one_of_the_nodes,
send_check_servers_is_called_before_last_server_got_dump,
remote_ops_are_not_sent_before_last_server_got_dump
remote_ops_are_not_sent_before_last_server_got_dump,
pause_on_remote_crashes
].

cets_seq_no_log_cases() ->
Expand Down Expand Up @@ -1231,6 +1232,20 @@ pause_on_remote_node_returns_if_monitor_process_dies(Config) ->
exit(MonitorProcess, killed),
wait_for_down(TestPid).

pause_on_remote_crashes(Config) ->
#{ct2 := Peer2} = proplists:get_value(peers, Config),
mock_pause_on_remote_node_failing(),
Tab = make_name(Config),
Node1 = node(),
{ok, Pid1} = start(Node1, Tab),
{ok, Pid2} = start(Peer2, Tab),
{error,
{task_failed,
{assert_all_ok, [{Node1, {error, {exception, mock_pause_on_remote_node_failing, _}}}]},
#{}}} =
rpc(Peer2, cets_join, join, [lock_name(Config), #{}, Pid1, Pid2, #{}]),
ok.

%% Happens when one node receives send_dump and looses connection with the node
%% that runs cets_join logic.
send_check_servers_is_called_before_last_server_got_dump(Config) ->
Expand Down Expand Up @@ -3218,6 +3233,12 @@ mock_epmd() ->
(Name, Host, Family) -> meck:passthrough([Name, Host, Family])
end).

mock_pause_on_remote_node_failing() ->
meck:new(cets_join, [passthrough]),
meck:expect(cets_join, pause_on_remote_node, fun(_JoinerPid, _AllPids) ->
error(mock_pause_on_remote_node_failing)
end).

%% Fails if List has duplicates
assert_unique(List) ->
?assertEqual([], List -- lists:usort(List)),
Expand Down

0 comments on commit bf92967

Please sign in to comment.