@@ -154,7 +154,7 @@ end_per_testcase(Testcase, Config) ->
154154 ? awaitMatch (
155155 true ,
156156 begin
157- DlxWorkers = rabbit_ct_broker_helpers :rpc_all (Config , supervisor , which_children , [rabbit_fifo_dlx_sup_sup ]),
157+ DlxWorkers = rabbit_ct_broker_helpers :rpc_all (Config , ? MODULE , dlx_workers , []),
158158 lists :all (fun (L ) -> L =:= [] end , DlxWorkers )
159159 end , 60000 ),
160160
@@ -513,7 +513,7 @@ drop_head_falls_back_to_at_most_once(Config) ->
513513 consistently (
514514 ? _assertMatch (
515515 [_ , {active , 0 }, _ , _ ],
516- rpc (Config , Server , supervisor , count_children , [rabbit_fifo_dlx_sup_sup ]))).
516+ rpc (Config , Server , ? MODULE , dlx_count_children , []))).
517517
518518% % Test that dynamically switching dead-letter-strategy works.
519519switch_strategy (Config ) ->
@@ -935,7 +935,7 @@ single_dlx_worker(Config) ->
935935 [[_ , {active , 1 }, _ , _ ],
936936 [_ , {active , 0 }, _ , _ ],
937937 [_ , {active , 0 }, _ , _ ]],
938- rabbit_ct_broker_helpers :rpc_all (Config , supervisor , count_children , [rabbit_fifo_dlx_sup_sup ])),
938+ rabbit_ct_broker_helpers :rpc_all (Config , ? MODULE , dlx_count_children , [])),
939939
940940 ok = rabbit_ct_broker_helpers :stop_broker (Config , Server1 ),
941941 RaName = ra_name (SourceQ ),
@@ -948,7 +948,7 @@ single_dlx_worker(Config) ->
948948 consistently (
949949 ? _assertEqual (
950950 0 ,
951- length (rpc (Config , Server1 , supervisor , which_children , [rabbit_fifo_dlx_sup_sup ], 1000 )))),
951+ length (rpc (Config , Server1 , ? MODULE , dlx_workers , [], 1000 )))),
952952
953953 % % Kill the leader node to verify the DLX worker follows leadership.
954954 % % We kill the node rather than just the Ra process: killing only the process
@@ -965,7 +965,7 @@ single_dlx_worker(Config) ->
965965
966966assert_active_dlx_workers (N , Config , Server ) ->
967967 ? awaitMatch (N ,
968- length (rpc (Config , Server , supervisor , which_children , [rabbit_fifo_dlx_sup_sup ], 5000 )),
968+ length (rpc (Config , Server , ? MODULE , dlx_workers , [], 5000 )),
969969 60_000 ).
970970
971971declare_queue (Channel , Queue , Args ) ->
@@ -999,3 +999,18 @@ counted(Metric, Config) ->
999999metric (Metric , Counters ) ->
10001000 Metrics = maps :get (#{queue_type => rabbit_quorum_queue , dead_letter_strategy => at_least_once }, Counters ),
10011001 maps :get (Metric , Metrics ).
1002+
1003+ % % Returns the list of DLX worker children, handling both the old
1004+ % % (rabbit_fifo_dlx_sup) and new (rabbit_fifo_dlx_sup_sup) supervisor names
1005+ % % for mixed-cluster compatibility.
1006+ dlx_workers () ->
1007+ supervisor :which_children (dlx_sup_name ()).
1008+
1009+ dlx_count_children () ->
1010+ supervisor :count_children (dlx_sup_name ()).
1011+
1012+ dlx_sup_name () ->
1013+ case whereis (rabbit_fifo_dlx_sup_sup ) of
1014+ undefined -> rabbit_fifo_dlx_sup ;
1015+ _ -> rabbit_fifo_dlx_sup_sup
1016+ end .
0 commit comments