@@ -220,15 +220,29 @@ delayed_messages_count(Config) ->
220
220
Exchanges = rabbit_ct_broker_helpers :rpc (Config , 0 ,
221
221
rabbit_exchange , info_all , [<<" /" >>]),
222
222
223
- [ Exchange ] = lists : filter (
223
+ FilterEx =
224
224
fun (X ) ->
225
- {resource , <<" /" >>, exchange , Ex } == proplists :get_value (name , X )
225
+ {resource , <<" /" >>, exchange , Ex } == proplists :get_value (name , X )
226
226
end ,
227
- Exchanges ),
227
+
228
+ [Exchange ] = lists :filter (FilterEx , Exchanges ),
228
229
{messages_delayed , 6 } = proplists :lookup (messages_delayed , Exchange ),
229
230
231
+ % % Set a policy for the exchange
232
+ PolicyName = make_policy_name (Config , " 1" ),
233
+ rabbit_ct_broker_helpers :set_policy (
234
+ Config , 0 , PolicyName , <<" ^" , Ex /binary >>, <<" exchanges" >>, [{<<" alternate-exchange" >>, <<" altex" >>}]),
235
+
236
+ % % Same message count returned for modified exchange
237
+ Exchanges2 = rabbit_ct_broker_helpers :rpc (Config , 0 ,
238
+ rabbit_exchange , info_all , [<<" /" >>]),
239
+
240
+ [Exchange2 ] = lists :filter (FilterEx , Exchanges2 ),
241
+ {messages_delayed , 6 } = proplists :lookup (messages_delayed , Exchange2 ),
242
+
230
243
consume (Chan , Q , Msgs ),
231
244
245
+ rabbit_ct_broker_helpers :clear_policy (Config , 0 , PolicyName ),
232
246
rabbit_ct_client_helpers :close_channel (Chan ),
233
247
ok .
234
248
@@ -418,3 +432,7 @@ make_exchange_name(Config, Suffix) ->
418
432
make_queue_name (Config , Suffix ) ->
419
433
B = rabbit_ct_helpers :get_config (Config , test_resource_name ),
420
434
erlang :list_to_binary (" q-" ++ B ++ " -" ++ Suffix ).
435
+
436
+ make_policy_name (Config , Suffix ) ->
437
+ B = rabbit_ct_helpers :get_config (Config , test_resource_name ),
438
+ erlang :list_to_binary (" p-" ++ B ++ " -" ++ Suffix ).
0 commit comments