diff options
| author | dcorbacho <dparracorbacho@piotal.io> | 2019-09-16 12:00:58 +0100 |
|---|---|---|
| committer | dcorbacho <dparracorbacho@piotal.io> | 2019-09-16 12:01:49 +0100 |
| commit | d5213d4ba630da0dd85426d803dd53c5221d686b (patch) | |
| tree | 5f03dff44798fb0f3ef4a0e6fbe5f968c3cf88f9 | |
| parent | e60ac4fbe820827ed9e61facabbf3cc710ffb279 (diff) | |
| download | rabbitmq-server-git-d5213d4ba630da0dd85426d803dd53c5221d686b.tar.gz | |
Return number of queues per type
* Pretty-formatter ready
[#166480197]
| -rw-r--r-- | src/rabbit_amqqueue.erl | 6 | ||||
| -rw-r--r-- | test/dynamic_ha_SUITE.erl | 18 | ||||
| -rw-r--r-- | test/quorum_queue_SUITE.erl | 6 |
3 files changed, 25 insertions, 5 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index e4c262ad79..c061d18333 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -539,7 +539,11 @@ maybe_migrate(ByNode, MaxQueuesDesired) -> maybe_migrate(ByNode, _, []) -> {ok, maps:fold(fun(K, V, Acc) -> - [{K, length(V)} | Acc] + {CQs, QQs} = lists:splitwith(fun({_, Q, _}) -> + ?amqqueue_is_classic(Q) + end, V), + [[{<<"Node name">>, K}, {<<"Number of quorum queues">>, length(QQs)}, + {<<"Number of classic queues">>, length(CQs)}] | Acc] end, [], ByNode)}; maybe_migrate(ByNode, MaxQueuesDesired, [N | Nodes]) -> case maps:get(N, ByNode, []) of diff --git a/test/dynamic_ha_SUITE.erl b/test/dynamic_ha_SUITE.erl index 5eccfd2ad5..b1171a3f5f 100644 --- a/test/dynamic_ha_SUITE.erl +++ b/test/dynamic_ha_SUITE.erl @@ -571,7 +571,11 @@ rebalance_all(Config) -> {ok, Summary} = rpc:call(A, rabbit_amqqueue, rebalance, [classic, ".*", ".*"]), %% Check that we have at most 2 queues per node - ?assert(lists:all(fun({_, V}) -> V =< 2 end, Summary)), + ?assert(lists:all(fun(NodeData) -> + lists:all(fun({_, V}) when is_integer(V) -> V =< 2; + (_) -> true end, + NodeData) + end, Summary)), %% Check that Q1 and Q2 haven't moved assert_slaves(A, Q1, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), assert_slaves(A, Q2, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), @@ -608,7 +612,11 @@ rebalance_exactly(Config) -> {ok, Summary} = rpc:call(A, rabbit_amqqueue, rebalance, [classic, ".*", ".*"]), %% Check that we have at most 2 queues per node - ?assert(lists:all(fun({_, V}) -> V =< 2 end, Summary)), + ?assert(lists:all(fun(NodeData) -> + lists:all(fun({_, V}) when is_integer(V) -> V =< 2; + (_) -> true end, + NodeData) + end, Summary)), %% Check that Q1 and Q2 haven't moved ?assertEqual(A, node(proplists:get_value(pid, find_queue(Q1, A)))), ?assertEqual(A, node(proplists:get_value(pid, find_queue(Q2, A)))), @@ -647,7 +655,11 @@ rebalance_nodes(Config) -> {ok, Summary} = rpc:call(A, rabbit_amqqueue, rebalance, [classic, ".*", ".*"]), %% Check that we have at most 3 queues per node - ?assert(lists:all(fun({_, V}) -> V =< 3 end, Summary)), + ?assert(lists:all(fun(NodeData) -> + lists:all(fun({_, V}) when is_integer(V) -> V =< 3; + (_) -> true end, + NodeData) + end, Summary)), %% Check that Q1 and Q2 haven't moved ?assertEqual(A, node(proplists:get_value(pid, find_queue(Q1, A)))), ?assertEqual(A, node(proplists:get_value(pid, find_queue(Q2, A)))), diff --git a/test/quorum_queue_SUITE.erl b/test/quorum_queue_SUITE.erl index 819f8f8761..384e7a818e 100644 --- a/test/quorum_queue_SUITE.erl +++ b/test/quorum_queue_SUITE.erl @@ -706,7 +706,11 @@ rebalance(Config) -> ?assertMatch({ok, _, {_, Leader2}}, ra:members({ra_name(Q2), Server0})), %% Check that we have at most 2 queues per node - ?assert(lists:all(fun({_, V}) -> V =< 2 end, Summary)), + ?assert(lists:all(fun(NodeData) -> + lists:all(fun({_, V}) when is_integer(V) -> V =< 2; + (_) -> true end, + NodeData) + end, Summary)), ok. subscribe_should_fail_when_global_qos_true(Config) -> |
