summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkjnilsson <knilsson@pivotal.io>2018-11-30 14:07:22 +0000
committerkjnilsson <knilsson@pivotal.io>2018-12-04 17:16:08 +0000
commitea0e192dc193add8bf4c1250fbe1c9b15b999d29 (patch)
treef7fbe97129f96ab514a51db1d0abab94e716df04 /test
parenta4c00475eb6cf261ac7775244e518fc63ea8fa94 (diff)
downloadrabbitmq-server-git-ea0e192dc193add8bf4c1250fbe1c9b15b999d29.tar.gz
Better handle changing quorum queue leaders
All maps that track queues inside the channel should use the queue name atom rather than the server id as they key so that leader changes don't impact this tracking.
Diffstat (limited to 'test')
-rw-r--r--test/quorum_queue_SUITE.erl25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/quorum_queue_SUITE.erl b/test/quorum_queue_SUITE.erl
index 380b8ab59e..61fd7a1b2c 100644
--- a/test/quorum_queue_SUITE.erl
+++ b/test/quorum_queue_SUITE.erl
@@ -48,6 +48,7 @@ groups() ->
++ all_tests()},
{cluster_size_3, [], [
declare_during_node_down,
+ simple_confirm_availability_on_leader_change,
confirm_availability_on_leader_change,
recover_from_single_failure,
recover_from_multiple_failures,
@@ -1563,6 +1564,30 @@ declare_during_node_down(Config) ->
wait_for_messages_ready(Servers, RaName, 1),
ok.
+simple_confirm_availability_on_leader_change(Config) ->
+ [Node1, Node2, _Node3] =
+ rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
+
+ %% declare a queue on node2 - this _should_ host the leader on node 2
+ DCh = rabbit_ct_client_helpers:open_channel(Config, Node2),
+ QQ = ?config(queue_name, Config),
+ ?assertEqual({'queue.declare_ok', QQ, 0, 0},
+ declare(DCh, QQ, [{<<"x-queue-type">>, longstr, <<"quorum">>}])),
+
+ erlang:process_flag(trap_exit, true),
+ %% open a channel to another node
+ Ch = rabbit_ct_client_helpers:open_channel(Config, Node1),
+ #'confirm.select_ok'{} = amqp_channel:call(Ch, #'confirm.select'{}),
+ publish_confirm(Ch, QQ),
+
+ %% stop the node hosting the leader
+ stop_node(Config, Node2),
+ %% this should not fail as the channel should detect the new leader and
+ %% resend to that
+ publish_confirm(Ch, QQ),
+ ok = rabbit_ct_broker_helpers:start_node(Config, Node2),
+ ok.
+
confirm_availability_on_leader_change(Config) ->
[Node1, Node2, _Node3] =
rabbit_ct_broker_helpers:get_node_configs(Config, nodename),