Skip to content

Commit 857e2a7

Browse files
committed
Extend core leader health check tests and update badrpc error handling in cli tests
1 parent 76d66a1 commit 857e2a7

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

deps/rabbit/test/quorum_queue_SUITE.erl

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4161,7 +4161,38 @@ leader_health_check(Config) ->
41614161
?assertEqual([], rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, leader_health_check,
41624162
[<<"Q.2">>, <<"/">>])),
41634163
?assertEqual([], rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, leader_health_check,
4164-
[<<"Q.3">>, <<"/">>])).
4164+
[<<"Q.3">>, <<"/">>])),
4165+
4166+
Qs = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_amqqueue, list, []),
4167+
4168+
[{Q1_ClusterName, Q1Res}, {Q2_ClusterName, Q2Res}, {Q3_ClusterName, Q3Res}] =
4169+
lists:usort(
4170+
[begin
4171+
{ClusterName, _} = amqqueue:get_pid(Q),
4172+
{ClusterName, amqqueue:get_name(Q)}
4173+
end
4174+
|| Q <- Qs, amqqueue:get_type(Q) == rabbit_quorum_queue]),
4175+
4176+
rabbit_ct_broker_helpers:rpc(Config, 0, ra_leaderboard, clear, [Q1_ClusterName]),
4177+
rabbit_ct_broker_helpers:rpc(Config, 0, ra_leaderboard, clear, [Q2_ClusterName]),
4178+
rabbit_ct_broker_helpers:rpc(Config, 0, ra_leaderboard, clear, [Q3_ClusterName]),
4179+
4180+
Q1Data = amqqueue:to_printable(Q1Res, rabbit_quorum_queue),
4181+
Q2Data = amqqueue:to_printable(Q2Res, rabbit_quorum_queue),
4182+
Q3Data = amqqueue:to_printable(Q3Res, rabbit_quorum_queue),
4183+
4184+
?assertEqual([Q1Data], rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, leader_health_check,
4185+
[<<"Q.1">>, <<"/">>])),
4186+
?assertEqual([Q2Data], rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, leader_health_check,
4187+
[<<"Q.2">>, <<"/">>])),
4188+
?assertEqual([Q3Data], rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, leader_health_check,
4189+
[<<"Q.3">>, <<"/">>])),
4190+
?assertEqual([Q1Data, Q2Data, Q3Data],
4191+
lists:usort(rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, leader_health_check,
4192+
[<<".*">>, <<"/">>]))),
4193+
?assertEqual([Q1Data, Q2Data, Q3Data],
4194+
lists:usort(rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, leader_health_check,
4195+
[<<"Q.*">>, <<"/">>]))).
41654196

41664197
leader_locator_client_local(Config) ->
41674198
[Server1 | _] = Servers = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),

deps/rabbitmq_cli/test/queues/leader_health_check_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ defmodule RabbitMQ.CLI.Queues.Commands.LeaderHealthCheckCommandTest do
4343
@tag test_timeout: 3000
4444
test "run: targeting an unreachable node throws a badrpc" do
4545
assert match?(
46-
{:badrpc, _},
46+
{:error, {:badrpc, :nodedown}},
4747
@command.run(
4848
["quorum.queue.*"],
4949
%{node: :jake@thedog, vhost: "/", timeout: 200}

0 commit comments

Comments
 (0)