@@ -151,6 +151,7 @@ all_tests() ->
151151 message_bytes_metrics ,
152152 queue_length_limit_drop_head ,
153153 queue_length_limit_reject_publish ,
154+ queue_length_limit_policy_cleared ,
154155 subscribe_redelivery_limit ,
155156 subscribe_redelivery_limit_disable ,
156157 subscribe_redelivery_limit_many ,
@@ -2973,6 +2974,36 @@ queue_length_limit_reject_publish(Config) ->
29732974 ok = publish_confirm (Ch , QQ ),
29742975 ok .
29752976
2977+ queue_length_limit_policy_cleared (Config ) ->
2978+ [Server | _ ] = Servers = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
2979+
2980+ Ch = rabbit_ct_client_helpers :open_channel (Config , Server ),
2981+ QQ = ? config (queue_name , Config ),
2982+ ? assertEqual ({'queue.declare_ok' , QQ , 0 , 0 },
2983+ declare (Ch , QQ , [{<<" x-queue-type" >>, longstr , <<" quorum" >>}])),
2984+ ok = rabbit_ct_broker_helpers :set_policy (
2985+ Config , 0 , <<" max-length" >>, QQ , <<" queues" >>,
2986+ [{<<" max-length" >>, 2 },
2987+ {<<" overflow" >>, <<" reject-publish" >>}]),
2988+ timer :sleep (1000 ),
2989+ RaName = ra_name (QQ ),
2990+ QueryFun = fun rabbit_fifo :overview /1 ,
2991+ ? awaitMatch ({ok , {_ , #{config := #{max_length := 2 }}}, _ },
2992+ rpc :call (Server , ra , local_query , [RaName , QueryFun ]),
2993+ ? DEFAULT_AWAIT ),
2994+ # 'confirm.select_ok' {} = amqp_channel :call (Ch , # 'confirm.select' {}),
2995+ ok = publish_confirm (Ch , QQ ),
2996+ ok = publish_confirm (Ch , QQ ),
2997+ ok = publish_confirm (Ch , QQ ), % % QQs allow one message above the limit
2998+ wait_for_messages_ready (Servers , RaName , 3 ),
2999+ fail = publish_confirm (Ch , QQ ),
3000+ ok = rabbit_ct_broker_helpers :clear_policy (Config , 0 , <<" max-length" >>),
3001+ ? awaitMatch ({ok , {_ , #{config := #{max_length := undefined }}}, _ },
3002+ rpc :call (Server , ra , local_query , [RaName , QueryFun ]),
3003+ ? DEFAULT_AWAIT ),
3004+ ok = publish_confirm (Ch , QQ ),
3005+ wait_for_messages_ready (Servers , RaName , 4 ).
3006+
29763007purge (Config ) ->
29773008 [Server | _ ] = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
29783009
0 commit comments