Skip to content

Commit

Permalink
Use local function for ensuring qq proc dead
Browse files Browse the repository at this point in the history
  • Loading branch information
LoisSotoLopez committed Oct 1, 2024
1 parent 6d78078 commit 697fb7f
Showing 1 changed file with 14 additions and 30 deletions.
44 changes: 14 additions & 30 deletions deps/rabbit/test/quorum_queue_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1247,36 +1247,8 @@ policy_repair(Config) ->
?assert((GottenFails4 =:= 10) or (GottenFails4 =:= 9)),
consume_all(Ch, QQ),

% Make the queue process unavailable.
% Kill the process multiple times until its supervisor stops restarting it.
lists:foreach(fun(Srv) ->
KillUntil = fun KillUntil() ->
case
rabbit_ct_broker_helpers:rpc(
Config,
Srv,
erlang,
whereis,
[RaName])
of
undefined ->
ok;
Pid ->
rabbit_ct_broker_helpers:rpc(
Config,
Srv,
erlang,
exit,
[Pid, kill]
),
% Give some time for the supervisor to restart the process
timer:sleep(500),
KillUntil()
end
end,
KillUntil()
end,
Servers),
% Ensure the queue process is unavailable
lists:foreach(fun(Srv) -> ensure_qq_proc_dead(Config, Srv, RaName) end, Servers),

% Add policy with higher priority, allowing even more messages.
ExpectedMaxLength3 = 30,
Expand Down Expand Up @@ -4380,3 +4352,15 @@ consume_all(Ch, QQ) ->
end
end,
Consume([]).

ensure_qq_proc_dead(Config, Server, RaName) ->
case rabbit_ct_broker_helpers:rpc(Config, Server, erlang, whereis, [RaName]) of
undefined ->
ok;
Pid ->
rabbit_ct_broker_helpers:rpc(Config, Server, erlang, exit, [Pid, kill]),
%% Give some time for the supervisor to restart the process
timer:sleep(500),
ensure_qq_proc_dead(Config, Server, RaName)
end.

0 comments on commit 697fb7f

Please sign in to comment.