@@ -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 ,
@@ -3697,6 +3698,50 @@ queue_length_limit_drop_head(Config) ->
36973698 amqp_channel :call (Ch , # 'basic.get' {queue = QQ ,
36983699 no_ack = true })).
36993700
3701+ queue_length_bytes_limit_drop_head (Config ) ->
3702+ [Server | _ ] = Servers = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
3703+
3704+ Ch = rabbit_ct_client_helpers :open_channel (Config , Server ),
3705+ QQ = ? config (queue_name , Config ),
3706+ DLQ = <<" dead letter queue" >>,
3707+
3708+ ? assertEqual ({'queue.declare_ok' , DLQ , 0 , 0 },
3709+ declare (Ch , DLQ , [{<<" x-queue-type" >>, longstr , <<" quorum" >>}])),
3710+ ? assertEqual ({'queue.declare_ok' , QQ , 0 , 0 },
3711+ declare (Ch , QQ , [{<<" x-queue-type" >>, longstr , <<" quorum" >>},
3712+ {<<" x-overflow" >>, longstr , <<" drop-head" >>},
3713+ {<<" x-max-length-bytes" >>, long , 1000 },
3714+ {<<" x-dead-letter-exchange" >>, longstr , <<>>},
3715+ {<<" x-dead-letter-routing-key" >>, longstr , DLQ }])),
3716+
3717+ LargePayload = binary :copy (<<" x" >>, 1500 ),
3718+ ok = amqp_channel :cast (Ch ,
3719+ # 'basic.publish' {routing_key = QQ },
3720+ # amqp_msg {payload = <<" m1" >>}),
3721+ ok = amqp_channel :cast (Ch ,
3722+ # 'basic.publish' {routing_key = QQ },
3723+ # amqp_msg {payload = <<" m2" >>}),
3724+ ok = amqp_channel :cast (Ch ,
3725+ # 'basic.publish' {routing_key = QQ },
3726+ # amqp_msg {payload = LargePayload }),
3727+ wait_for_consensus (QQ , Config ),
3728+ wait_for_consensus (DLQ , Config ),
3729+ RaName = ra_name (DLQ ),
3730+ wait_for_messages_ready (Servers , RaName , 3 ),
3731+ ? assertMatch ({# 'basic.get_ok' {}, # amqp_msg {payload = <<" m1" >>}},
3732+ amqp_channel :call (Ch , # 'basic.get' {queue = DLQ ,
3733+ no_ack = true })),
3734+ ? assertMatch ({# 'basic.get_ok' {}, # amqp_msg {payload = <<" m2" >>}},
3735+ amqp_channel :call (Ch , # 'basic.get' {queue = DLQ ,
3736+ no_ack = true })),
3737+ ? assertMatch ({# 'basic.get_ok' {}, # amqp_msg {payload = LargePayload }},
3738+ amqp_channel :call (Ch , # 'basic.get' {queue = DLQ ,
3739+ no_ack = true })),
3740+
3741+ [? assertEqual (# 'queue.delete_ok' {message_count = 0 },
3742+ amqp_channel :call (Ch , # 'queue.delete' {queue = Q }))
3743+ || Q <- [QQ , DLQ ]].
3744+
37003745queue_length_limit_reject_publish (Config ) ->
37013746 [Server | _ ] = Servers = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
37023747
0 commit comments