@@ -77,7 +77,8 @@ groups() ->
7777 local_to_local_stream_credit_flow_on_confirm ,
7878 local_to_local_stream_credit_flow_on_publish ,
7979 local_to_local_stream_credit_flow_no_ack ,
80- local_to_local_simple_uri
80+ local_to_local_simple_uri ,
81+ local_to_local_counters
8182 ]}
8283 ].
8384
@@ -1050,6 +1051,36 @@ local_to_local_simple_uri(Config) ->
10501051 none ]),
10511052 shovel_test_utils :await_shovel (Config , ? PARAM ).
10521053
1054+ local_to_local_counters (Config ) ->
1055+ Src = ? config (srcq , Config ),
1056+ Dest = ? config (destq , Config ),
1057+ % % Let's restart the node so the counters are reset
1058+ ok = rabbit_ct_broker_helpers :stop_node (Config , 0 ),
1059+ ok = rabbit_ct_broker_helpers :start_node (Config , 0 ),
1060+ with_session (
1061+ Config ,
1062+ fun (Sess ) ->
1063+ ? awaitMatch (#{publishers := 0 , consumers := 0 },
1064+ get_global_counters (Config ), 30_000 ),
1065+ shovel_test_utils :set_param (Config , ? PARAM ,
1066+ [{<<" src-protocol" >>, <<" local" >>},
1067+ {<<" src-queue" >>, Src },
1068+ {<<" dest-protocol" >>, <<" local" >>},
1069+ {<<" dest-queue" >>, Dest }
1070+ ]),
1071+ ? awaitMatch (#{publishers := 1 , consumers := 1 },
1072+ get_global_counters (Config ), 30_000 ),
1073+ _ = publish_many (Sess , Src , Dest , <<" tag1" >>, 150 ),
1074+ ? awaitMatch (#{consumers := 1 , publishers := 1 ,
1075+ messages_received_total := 150 ,
1076+ messages_received_confirm_total := 150 ,
1077+ messages_routed_total := 150 ,
1078+ messages_unroutable_dropped_total := 0 ,
1079+ messages_unroutable_returned_total := 0 ,
1080+ messages_confirmed_total := 150 },
1081+ get_global_counters (Config ), 30_000 )
1082+ end ).
1083+
10531084% %----------------------------------------------------------------------------
10541085with_session (Config , Fun ) ->
10551086 with_session (Config , <<" /" >>, Fun ).
@@ -1217,3 +1248,10 @@ delete_queue(Name, VHost) ->
12171248 _ ->
12181249 ok
12191250 end .
1251+
1252+ get_global_counters (Config ) ->
1253+ get_global_counters0 (Config , #{protocol => 'local-shovel' }).
1254+
1255+ get_global_counters0 (Config , Key ) ->
1256+ Overview = rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_global_counters , overview , []),
1257+ maps :get (Key , Overview ).
0 commit comments