5454 logging_to_exchange_works /1 ,
5555 update_log_exchange_config /1 ,
5656 use_exchange_logger_when_enabling_khepri_db /1 ,
57+ use_exchange_logger_when_enabling_all_feature_flags /1 ,
5758
5859 logging_to_syslog_works /1 ]).
5960
@@ -101,7 +102,8 @@ groups() ->
101102 {exchange_output , [],
102103 [logging_to_exchange_works ,
103104 update_log_exchange_config ,
104- use_exchange_logger_when_enabling_khepri_db ]},
105+ use_exchange_logger_when_enabling_khepri_db ,
106+ use_exchange_logger_when_enabling_all_feature_flags ]},
105107
106108 {syslog_output , [],
107109 [logging_to_syslog_works ]}
@@ -151,8 +153,6 @@ init_per_testcase(Testcase, Config) ->
151153 % % The exchange output requires RabbitMQ to run. All testcases in this
152154 % % group will run in the context of that RabbitMQ node.
153155 exchange_output ->
154- ExchProps = [{enabled , true },
155- {level , debug }],
156156 Config1 = rabbit_ct_helpers :set_config (
157157 Config ,
158158 [{rmq_nodename_suffix , Testcase }]),
@@ -162,15 +162,29 @@ init_per_testcase(Testcase, Config) ->
162162 Config1 ,
163163 [{rmq_nodes_count , 3 },
164164 {metadata_store , mnesia }]);
165+ use_exchange_logger_when_enabling_all_feature_flags ->
166+ rabbit_ct_helpers :set_config (
167+ Config1 ,
168+ [{rmq_nodes_count , 3 }]);
165169 _ ->
166170 rabbit_ct_helpers :set_config (
167171 Config1 ,
168172 [{rmq_nodes_count , 1 }])
169173 end ,
170- Config3 = rabbit_ct_helpers :merge_app_env (
171- Config2 ,
172- {rabbit , [{log , [{exchange , ExchProps },
173- {file , [{level , debug }]}]}]}),
174+ LogCfg = {log , [
175+ {exchange , [{enabled , true }, {level , debug }]},
176+ {file , [{level , debug }]}
177+ ]},
178+ Config3 = case Testcase of
179+ use_exchange_logger_when_enabling_all_feature_flags ->
180+ rabbit_ct_helpers :merge_app_env (
181+ Config2 , {rabbit , [LogCfg ,
182+ {forced_feature_flags_on_init , []}
183+ ]});
184+ _ ->
185+ rabbit_ct_helpers :merge_app_env (
186+ Config2 , {rabbit , [LogCfg ]})
187+ end ,
174188 rabbit_ct_helpers :run_steps (
175189 Config3 ,
176190 rabbit_ct_broker_helpers :setup_steps () ++
@@ -1122,6 +1136,50 @@ use_exchange_logger_when_enabling_khepri_db(Config) ->
11221136 ok ,
11231137 rabbit_ct_broker_helpers :enable_feature_flag (Config , khepri_db )).
11241138
1139+ % % Test case for https://github.com/rabbitmq/rabbitmq-server/discussions/11652
1140+ use_exchange_logger_when_enabling_all_feature_flags (Config ) ->
1141+ {Conn , Chan } = rabbit_ct_client_helpers :open_connection_and_channel (Config ),
1142+
1143+ # 'queue.declare_ok' {} = amqp_channel :call (
1144+ Chan , # 'queue.declare' {queue = <<" cq" >>,
1145+ durable = true ,
1146+ arguments = [{<<" x-queue-type" >>, longstr , <<" classic" >>}]
1147+ }),
1148+ # 'queue.declare_ok' {} = amqp_channel :call (
1149+ Chan , # 'queue.declare' {queue = <<" qq" >>,
1150+ durable = true ,
1151+ arguments = [{<<" x-queue-type" >>, longstr , <<" quorum" >>}]
1152+ }),
1153+ # 'queue.declare_ok' {} = amqp_channel :call (
1154+ Chan , # 'queue.declare' {queue = <<" sq" >>,
1155+ durable = true ,
1156+ arguments = [{<<" x-queue-type" >>, longstr , <<" stream" >>}]
1157+ }),
1158+ [# 'queue.bind_ok' {} = amqp_channel :call (
1159+ Chan , # 'queue.bind' {queue = QName ,
1160+ exchange = <<" amq.rabbitmq.log" >>,
1161+ routing_key = <<" #" >>}) ||
1162+ QName <- [<<" cq" >>, <<" qq" >>, <<" sq" >>]],
1163+
1164+ % % Sanity check that there is at least one disabled stable feature flag.
1165+ DisabledFFsBefore = rabbit_ct_broker_helpers :rpc (Config , rabbit_feature_flags , list , [disabled , stable ]),
1166+ ? assertNotEqual (0 , maps :size (DisabledFFsBefore )),
1167+
1168+ ? assertEqual (ok , rabbit_ct_broker_helpers :rpc (Config , rabbit_feature_flags , enable_all , [stable ])),
1169+
1170+ DisabledFFsAfter = rabbit_ct_broker_helpers :rpc (Config , rabbit_feature_flags , list , [disabled , stable ]),
1171+ ? assertEqual (0 , maps :size (DisabledFFsAfter )),
1172+
1173+ # 'queue.delete_ok' {message_count = CountCQ } = amqp_channel :call (Chan , # 'queue.delete' {queue = <<" cq" >>}),
1174+ # 'queue.delete_ok' {message_count = CountQQ } = amqp_channel :call (Chan , # 'queue.delete' {queue = <<" qq" >>}),
1175+ # 'queue.delete_ok' {} = amqp_channel :call (Chan , # 'queue.delete' {queue = <<" sq" >>}),
1176+ % % We expect that some log messages ended up in the queues since rabbit_ff_controller does some logging
1177+ % % when enabling all feature flags.
1178+ ? assertNotEqual (0 , CountCQ ),
1179+ ? assertNotEqual (0 , CountQQ ),
1180+
1181+ rabbit_ct_client_helpers :close_connection_and_channel (Conn , Chan ).
1182+
11251183logging_to_syslog_works (Config ) ->
11261184 Context = default_context (Config ),
11271185 ok = application :set_env (
0 commit comments