diff options
| author | Diana Corbacho <diana@rabbitmq.com> | 2017-02-14 15:21:23 +0000 |
|---|---|---|
| committer | Diana Corbacho <diana@rabbitmq.com> | 2017-02-14 16:27:25 +0000 |
| commit | 1d9a24e71ef8e67c3f1fe2bfad646cf61b74d661 (patch) | |
| tree | 69e544fa1dc109016afcaae48dc87d2eb509b5eb | |
| parent | 86a77a2000c8adaac1df6473533bce55893da353 (diff) | |
| download | rabbitmq-server-git-1d9a24e71ef8e67c3f1fe2bfad646cf61b74d661.tar.gz | |
Test that gen_server2 buffer length stats are generated for a gen_server2
| -rw-r--r-- | test/priority_queue_SUITE.erl | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/priority_queue_SUITE.erl b/test/priority_queue_SUITE.erl index 05853ebc1f..a47076b4e9 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, @@ -213,6 +214,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">>, |
