@@ -1620,8 +1620,11 @@ single_active_consumer_state_enter_leader_include_waiting_consumers_test(Config)
16201620 ],
16211621 {State1 , _ } = run_log (Config , State0 , Entries ),
16221622 Effects = rabbit_fifo :state_enter (leader , State1 ),
1623- % % 2 effects for each consumer process (channel process), 1 effect for the node,
1624- ? assertEqual (2 * 3 + 1 + 1 + 1 , length (Effects )).
1623+ ct :pal (" Efx ~p " , [Effects ]),
1624+ % % 2 effects for each consumer process (channel process),
1625+ % % 1 effect for the node,
1626+ % % 1 for decorators
1627+ ? assertEqual (2 * 3 + 1 + 1 , length (Effects )).
16251628
16261629single_active_consumer_state_enter_eol_include_waiting_consumers_test (Config ) ->
16271630 Resource = rabbit_misc :r (" /" , queue , ? FUNCTION_NAME_B ),
@@ -3223,6 +3226,39 @@ modify_test(Config) ->
32233226
32243227 ok .
32253228
3229+ priorities_expire_test (Config ) ->
3230+ State0 = init (#{name => ? FUNCTION_NAME ,
3231+ queue_resource => rabbit_misc :r (" /" , queue ,
3232+ ? FUNCTION_NAME_B )}),
3233+ Pid1 = spawn (fun () -> ok end ),
3234+
3235+ Entries =
3236+ [
3237+ {? LINE , make_enqueue (Pid1 , 1 ,
3238+ mk_mc (<<" p1" >>, # 'P_basic' {priority = 9 ,
3239+ expiration = <<" 100" >>}))},
3240+ {? LINE , make_enqueue (Pid1 , 2 ,
3241+ mk_mc (<<" p1" >>, # 'P_basic' {priority = 9 ,
3242+ expiration = <<" 100000" >>}))},
3243+ {? LINE , make_enqueue (Pid1 , 3 ,
3244+ mk_mc (<<" p7" >>, # 'P_basic' {priority = 7 ,
3245+ expiration = <<" 100" >>}))},
3246+ {? LINE , make_enqueue (Pid1 , 4 ,
3247+ mk_mc (<<" p7" >>, # 'P_basic' {priority = 7 ,
3248+ expiration = <<" 100000" >>}))},
3249+ {? LINE , make_enqueue (Pid1 , 5 ,
3250+ mk_mc (<<" p7b" >>, # 'P_basic' {priority = 3 }))},
3251+
3252+ {? LINE + 101 , {timeout , {expire_msgs , shallow }}},
3253+
3254+ ? ASSERT (_ , fun (State ) ->
3255+ ? assertMatch (#{num_messages := 3 },
3256+ rabbit_fifo :overview (State ))
3257+ end )
3258+ ],
3259+ {_State2 , _ } = run_log (Config , State0 , Entries ),
3260+ ok .
3261+
32263262% % Utility
32273263% %
32283264
@@ -3232,6 +3268,7 @@ apply(Meta, Entry, State) -> rabbit_fifo:apply(Meta, Entry, State).
32323268init_aux (Conf ) -> rabbit_fifo :init_aux (Conf ).
32333269handle_aux (S , T , C , A , A2 ) -> rabbit_fifo :handle_aux (S , T , C , A , A2 ).
32343270make_checkout (C , S , M ) -> rabbit_fifo :make_checkout (C , S , M ).
3271+ make_enqueue (P , S , M ) -> rabbit_fifo :make_enqueue (P , S , M ).
32353272
32363273cid (A ) when is_atom (A ) ->
32373274 atom_to_binary (A , utf8 ).
@@ -3242,10 +3279,13 @@ single_active_invariant( #rabbit_fifo{consumers = Cons}) ->
32423279 end , Cons )).
32433280
32443281mk_mc (Body ) ->
3282+ mk_mc (Body , # 'P_basic' {}).
3283+
3284+ mk_mc (Body , BasicProps ) ->
32453285 mc_amqpl :from_basic_message (
32463286 # basic_message {routing_keys = [<<" " >>],
32473287 exchange_name = # resource {name = <<" x" >>,
32483288 kind = exchange ,
32493289 virtual_host = <<" v" >>},
3250- content = # content {properties = # 'P_basic' {} ,
3290+ content = # content {properties = BasicProps ,
32513291 payload_fragments_rev = [Body ]}}).
0 commit comments