1515-include_lib (" amqp_client/include/amqp_client.hrl" ).
1616-include_lib (" rabbitmq_ct_helpers/include/rabbit_assert.hrl" ).
1717
18+ -import (rabbit_ct_broker_helpers ,
19+ [rpc /4 ]).
20+
1821-export ([suite /0 ,
1922 all /0 ,
2023 groups /0 ,
5457 logging_to_exchange_works /1 ,
5558 update_log_exchange_config /1 ,
5659 use_exchange_logger_when_enabling_khepri_db /1 ,
60+ use_exchange_logger_when_enabling_all_feature_flags /1 ,
5761
5862 logging_to_syslog_works /1 ]).
5963
@@ -101,7 +105,8 @@ groups() ->
101105 {exchange_output , [],
102106 [logging_to_exchange_works ,
103107 update_log_exchange_config ,
104- use_exchange_logger_when_enabling_khepri_db ]},
108+ use_exchange_logger_when_enabling_khepri_db ,
109+ use_exchange_logger_when_enabling_all_feature_flags ]},
105110
106111 {syslog_output , [],
107112 [logging_to_syslog_works ]}
@@ -151,8 +156,6 @@ init_per_testcase(Testcase, Config) ->
151156 % % The exchange output requires RabbitMQ to run. All testcases in this
152157 % % group will run in the context of that RabbitMQ node.
153158 exchange_output ->
154- ExchProps = [{enabled , true },
155- {level , debug }],
156159 Config1 = rabbit_ct_helpers :set_config (
157160 Config ,
158161 [{rmq_nodename_suffix , Testcase }]),
@@ -162,15 +165,29 @@ init_per_testcase(Testcase, Config) ->
162165 Config1 ,
163166 [{rmq_nodes_count , 3 },
164167 {metadata_store , mnesia }]);
168+ use_exchange_logger_when_enabling_all_feature_flags ->
169+ rabbit_ct_helpers :set_config (
170+ Config1 ,
171+ [{rmq_nodes_count , 3 }]);
165172 _ ->
166173 rabbit_ct_helpers :set_config (
167174 Config1 ,
168175 [{rmq_nodes_count , 1 }])
169176 end ,
170- Config3 = rabbit_ct_helpers :merge_app_env (
171- Config2 ,
172- {rabbit , [{log , [{exchange , ExchProps },
173- {file , [{level , debug }]}]}]}),
177+ LogCfg = {log , [
178+ {exchange , [{enabled , true }, {level , debug }]},
179+ {file , [{level , debug }]}
180+ ]},
181+ Config3 = case Testcase of
182+ use_exchange_logger_when_enabling_all_feature_flags ->
183+ rabbit_ct_helpers :merge_app_env (
184+ Config2 , {rabbit , [LogCfg ,
185+ {forced_feature_flags_on_init , []}
186+ ]});
187+ _ ->
188+ rabbit_ct_helpers :merge_app_env (
189+ Config2 , {rabbit , [LogCfg ]})
190+ end ,
174191 rabbit_ct_helpers :run_steps (
175192 Config3 ,
176193 rabbit_ct_broker_helpers :setup_steps () ++
@@ -1122,6 +1139,50 @@ use_exchange_logger_when_enabling_khepri_db(Config) ->
11221139 ok ,
11231140 rabbit_ct_broker_helpers :enable_feature_flag (Config , khepri_db )).
11241141
1142+ % % Test case for https://github.com/rabbitmq/rabbitmq-server/discussions/11652
1143+ use_exchange_logger_when_enabling_all_feature_flags (Config ) ->
1144+ case rabbit_ct_helpers :is_mixed_versions () of
1145+ true ->
1146+ {skip , " This test case tests enabling all stable feature flags after "
1147+ " a rolling upgrade completed, i.e. all nodes run the same version." };
1148+ false ->
1149+ {_Conn , Chan } = rabbit_ct_client_helpers :open_connection_and_channel (Config ),
1150+ QNames = [<<" cq" >>, <<" qq" >>, <<" sq" >>],
1151+
1152+ # 'queue.declare_ok' {} = amqp_channel :call (
1153+ Chan , # 'queue.declare' {
1154+ queue = <<" cq" >>,
1155+ durable = true ,
1156+ arguments = [{<<" x-queue-type" >>, longstr , <<" classic" >>}]
1157+ }),
1158+ # 'queue.declare_ok' {} = amqp_channel :call (
1159+ Chan , # 'queue.declare' {
1160+ queue = <<" qq" >>,
1161+ durable = true ,
1162+ arguments = [{<<" x-queue-type" >>, longstr , <<" quorum" >>}]
1163+ }),
1164+ # 'queue.declare_ok' {} = amqp_channel :call (
1165+ Chan , # 'queue.declare' {
1166+ queue = <<" sq" >>,
1167+ durable = true ,
1168+ arguments = [{<<" x-queue-type" >>, longstr , <<" stream" >>}]
1169+ }),
1170+ [# 'queue.bind_ok' {} = amqp_channel :call (
1171+ Chan , # 'queue.bind' {
1172+ queue = QName ,
1173+ exchange = <<" amq.rabbitmq.log" >>,
1174+ routing_key = <<" #" >>}) ||
1175+ QName <- QNames ],
1176+
1177+ % % Enabling all stable feature flags should not get stuck.
1178+ ? assertEqual (ok , rpc (Config , rabbit_feature_flags , enable_all , [stable ])),
1179+
1180+ ? assertEqual (#{}, rpc (Config , rabbit_feature_flags , list , [disabled , stable ])),
1181+
1182+ % % Sanity check that at least one log message ended up in all queues.
1183+ [ok = queue_utils :wait_for_min_messages (Config , QName , 1 ) || QName <- QNames ]
1184+ end .
1185+
11251186logging_to_syslog_works (Config ) ->
11261187 Context = default_context (Config ),
11271188 ok = application :set_env (
0 commit comments