Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Commit e9caee3

Browse files
dcorbachokjnilsson
authored andcommitted
Test metrics removal on queue delete for quorum queues
1 parent 36e5a38 commit e9caee3

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/rabbit_mgmt_http_SUITE.erl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ all_tests() -> [
8686
multiple_invalid_connections_test,
8787
exchanges_test,
8888
queues_test,
89+
quorum_queues_test,
8990
queues_well_formed_json_test,
9091
bindings_test,
9192
bindings_post_test,
@@ -949,6 +950,40 @@ queues_test(Config) ->
949950
http_delete(Config, "/queues/downvhost/bar", {group, '2xx'}),
950951
passed.
951952

953+
quorum_queues_test(Config) ->
954+
%% Test in a loop that no metrics are left behing after deleting a queue
955+
quorum_queues_test_loop(Config, 5).
956+
957+
quorum_queues_test_loop(_Config, 0) ->
958+
passed;
959+
quorum_queues_test_loop(Config, N) ->
960+
Good = [{durable, true}, {arguments, [{'x-queue-type', 'quorum'}]}],
961+
http_get(Config, "/queues/%2f/qq", ?NOT_FOUND),
962+
http_put(Config, "/queues/%2f/qq", Good, {group, '2xx'}),
963+
964+
{Conn, Ch} = open_connection_and_channel(Config),
965+
Publish = fun() ->
966+
amqp_channel:call(
967+
Ch, #'basic.publish'{exchange = <<"">>,
968+
routing_key = <<"qq">>},
969+
#amqp_msg{payload = <<"message">>})
970+
end,
971+
Publish(),
972+
Publish(),
973+
wait_until(fun() ->
974+
2 == maps:get(messages, http_get(Config, "/queues/%2f/qq?lengths_age=60&lengths_incr=5&msg_rates_age=60&msg_rates_incr=5&data_rates_age=60&data_rates_incr=5"), undefined)
975+
end, 100),
976+
977+
http_delete(Config, "/queues/%2f/qq", {group, '2xx'}),
978+
http_put(Config, "/queues/%2f/qq", Good, {group, '2xx'}),
979+
980+
wait_until(fun() ->
981+
0 == maps:get(messages, http_get(Config, "/queues/%2f/qq?lengths_age=60&lengths_incr=5&msg_rates_age=60&msg_rates_incr=5&data_rates_age=60&data_rates_incr=5"), undefined)
982+
end, 100),
983+
984+
http_delete(Config, "/queues/%2f/qq", {group, '2xx'}),
985+
quorum_queues_test_loop(Config, N-1).
986+
952987
queues_well_formed_json_test(Config) ->
953988
%% TODO This test should be extended to the whole API
954989
Good = [{durable, true}],

0 commit comments

Comments
 (0)