summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorArnaud Cogoluègnes <acogoluegnes@gmail.com>2018-05-15 15:52:57 +0200
committerGitHub <noreply@github.com>2018-05-15 15:52:57 +0200
commit92261a466039f80a219f3c41e82c17be93eadc1d (patch)
tree66b9e4310d18f862daf6c71235d82732e3741f0f /test
parent117eb9bd268b8b8a47fb1e3478575a2a380227c4 (diff)
parent75cee2c119fe257cf70e876955c9bb201a9d2b38 (diff)
downloadrabbitmq-server-git-92261a466039f80a219f3c41e82c17be93eadc1d.tar.gz
Merge pull request #1597 from rabbitmq/rabbitmq-server-1590
Hard cap for maximum priorities
Diffstat (limited to 'test')
-rw-r--r--test/priority_queue_SUITE.erl29
1 files changed, 27 insertions, 2 deletions
diff --git a/test/priority_queue_SUITE.erl b/test/priority_queue_SUITE.erl
index a1ae66dbbb..cfa98b94c7 100644
--- a/test/priority_queue_SUITE.erl
+++ b/test/priority_queue_SUITE.erl
@@ -17,6 +17,7 @@
-module(priority_queue_SUITE).
-include_lib("common_test/include/ct.hrl").
+-include_lib("eunit/include/eunit.hrl").
-include_lib("amqp_client/include/amqp_client.hrl").
-compile(export_all).
@@ -46,7 +47,9 @@ groups() ->
simple_order,
straight_through,
invoke,
- gen_server2_stats
+ gen_server2_stats,
+ negative_max_priorities,
+ max_priorities_above_hard_limit
]},
{cluster_size_3, [], [
mirror_queue_auto_ack,
@@ -192,6 +195,28 @@ straight_through(Config) ->
rabbit_ct_client_helpers:close_connection(Conn),
passed.
+max_priorities_above_hard_limit(Config) ->
+ {Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
+ Q = <<"max_priorities_above_hard_limit">>,
+ ?assertExit(
+ {{shutdown, {server_initiated_close, 406, _}}, _},
+ %% Note that lower values (e.g. 300) will cause overflow the byte type here.
+ %% However, values >= 256 would still be rejected when used by
+ %% other clients
+ declare(Ch, Q, 3000)),
+ rabbit_ct_client_helpers:close_connection(Conn),
+ passed.
+
+negative_max_priorities(Config) ->
+ {Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
+ Q = <<"negative_max_priorities">>,
+ ?assertExit(
+ {{shutdown, {server_initiated_close, 406, _}}, _},
+ declare(Ch, Q, -10)),
+ rabbit_ct_client_helpers:close_connection(Conn),
+ passed.
+
+
invoke(Config) ->
%% Synthetic test to check the invoke callback, as the bug tested here
%% is only triggered with a race condition.
@@ -669,7 +694,7 @@ get_ok(Ch, Q, Ack, PBin) ->
{#'basic.get_ok'{delivery_tag = DTag}, #amqp_msg{payload = PBin2}} =
amqp_channel:call(Ch, #'basic.get'{queue = Q,
no_ack = Ack =:= no_ack}),
- PBin = PBin2,
+ ?assertEqual(PBin, PBin2),
maybe_ack(Ch, Ack, DTag).
get_payload(Ch, Q, Ack, Ps) ->