@@ -167,6 +167,7 @@ all_tests() ->
167167 subscribe_redelivery_count ,
168168 message_bytes_metrics ,
169169 queue_length_limit_drop_head ,
170+ queue_length_bytes_limit_drop_head ,
170171 queue_length_limit_reject_publish ,
171172 queue_length_limit_policy_cleared ,
172173 subscribe_redelivery_limit ,
@@ -3669,6 +3670,50 @@ queue_length_limit_drop_head(Config) ->
36693670 amqp_channel :call (Ch , # 'basic.get' {queue = QQ ,
36703671 no_ack = true })).
36713672
3673+ queue_length_bytes_limit_drop_head (Config ) ->
3674+ [Server | _ ] = Servers = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
3675+
3676+ Ch = rabbit_ct_client_helpers :open_channel (Config , Server ),
3677+ QQ = ? config (queue_name , Config ),
3678+ DLQ = <<" dead letter queue" >>,
3679+
3680+ ? assertEqual ({'queue.declare_ok' , DLQ , 0 , 0 },
3681+ declare (Ch , DLQ , [{<<" x-queue-type" >>, longstr , <<" quorum" >>}])),
3682+ ? assertEqual ({'queue.declare_ok' , QQ , 0 , 0 },
3683+ declare (Ch , QQ , [{<<" x-queue-type" >>, longstr , <<" quorum" >>},
3684+ {<<" x-overflow" >>, longstr , <<" drop-head" >>},
3685+ {<<" x-max-length-bytes" >>, long , 1000 },
3686+ {<<" x-dead-letter-exchange" >>, longstr , <<>>},
3687+ {<<" x-dead-letter-routing-key" >>, longstr , DLQ }])),
3688+
3689+ LargePayload = binary :copy (<<" x" >>, 1500 ),
3690+ ok = amqp_channel :cast (Ch ,
3691+ # 'basic.publish' {routing_key = QQ },
3692+ # amqp_msg {payload = <<" m1" >>}),
3693+ ok = amqp_channel :cast (Ch ,
3694+ # 'basic.publish' {routing_key = QQ },
3695+ # amqp_msg {payload = <<" m2" >>}),
3696+ ok = amqp_channel :cast (Ch ,
3697+ # 'basic.publish' {routing_key = QQ },
3698+ # amqp_msg {payload = LargePayload }),
3699+ wait_for_consensus (QQ , Config ),
3700+ wait_for_consensus (DLQ , Config ),
3701+ RaName = ra_name (DLQ ),
3702+ wait_for_messages_ready (Servers , RaName , 3 ),
3703+ ? assertMatch ({# 'basic.get_ok' {}, # amqp_msg {payload = <<" m1" >>}},
3704+ amqp_channel :call (Ch , # 'basic.get' {queue = DLQ ,
3705+ no_ack = true })),
3706+ ? assertMatch ({# 'basic.get_ok' {}, # amqp_msg {payload = <<" m2" >>}},
3707+ amqp_channel :call (Ch , # 'basic.get' {queue = DLQ ,
3708+ no_ack = true })),
3709+ ? assertMatch ({# 'basic.get_ok' {}, # amqp_msg {payload = LargePayload }},
3710+ amqp_channel :call (Ch , # 'basic.get' {queue = DLQ ,
3711+ no_ack = true })),
3712+
3713+ [? assertEqual (# 'queue.delete_ok' {message_count = 0 },
3714+ amqp_channel :call (Ch , # 'queue.delete' {queue = Q }))
3715+ || Q <- [QQ , DLQ ]].
3716+
36723717queue_length_limit_reject_publish (Config ) ->
36733718 [Server | _ ] = Servers = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
36743719
0 commit comments