summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2017-02-15 00:05:49 +0300
committerMichael Klishin <michael@clojurewerkz.org>2017-02-15 00:05:49 +0300
commitc9b80faab8a99139bcac047f630be3ce28a508a6 (patch)
tree61e3f17d359736224036f69335ffdcc0e6ee944a /test
parente01aff8c523fe74b3a1f6c8a755376b05d3e4abf (diff)
parent82748534acce4a9c6cf05400e1c7bed3320a6d07 (diff)
downloadrabbitmq-server-git-c9b80faab8a99139bcac047f630be3ce28a508a6.tar.gz
Merge branch 'stable'
Diffstat (limited to 'test')
-rw-r--r--test/priority_queue_SUITE.erl26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/priority_queue_SUITE.erl b/test/priority_queue_SUITE.erl
index 8e1b48dd3b..eecd59b879 100644
--- a/test/priority_queue_SUITE.erl
+++ b/test/priority_queue_SUITE.erl
@@ -44,7 +44,8 @@ groups() ->
resume,
simple_order,
straight_through,
- invoke
+ invoke,
+ gen_server2_stats
]},
{cluster_size_3, [], [
mirror_queue_auto_ack,
@@ -214,6 +215,29 @@ invoke(Config) ->
rabbit_ct_client_helpers:close_connection(Conn),
passed.
+
+gen_server2_stats(Config) ->
+ %% Synthetic test to check the invoke callback, as the bug tested here
+ %% is only triggered with a race condition.
+ %% When mirroring is stopped, the backing queue of rabbit_amqqueue_process
+ %% changes from rabbit_mirror_queue_master to rabbit_priority_queue,
+ %% which shouldn't receive any invoke call. However, there might
+ %% be pending messages so the priority queue receives the
+ %% `run_backing_queue` cast message sent to the old master.
+ A = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename),
+ {Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, A),
+ Q = <<"gen_server2_stats_queue">>,
+ declare(Ch, Q, 3),
+ Pid = queue_pid(Config, A, rabbit_misc:r(<<"/">>, queue, Q)),
+ Metrics = rabbit_ct_broker_helpers:rpc(
+ Config, A, rabbit_core_metrics, get_gen_server2_stats,
+ [Pid]),
+ true = is_number(Metrics),
+ delete(Ch, Q),
+ rabbit_ct_client_helpers:close_channel(Ch),
+ rabbit_ct_client_helpers:close_connection(Conn),
+ passed.
+
dropwhile_fetchwhile(Config) ->
{Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
Q = <<"dropwhile_fetchwhile-queue">>,