3232 set_policy_when_cmq_is_not_permitted_from_conf /1 ,
3333
3434 when_transient_nonexcl_is_permitted_by_default /1 ,
35- when_transient_nonexcl_is_not_permitted_from_conf /1
35+ when_transient_nonexcl_is_not_permitted_from_conf /1 ,
36+
37+ when_queue_master_locator_is_permitted_by_default /1 ,
38+ when_queue_master_locator_is_not_permitted_from_conf /1
3639 ]).
3740
3841suite () ->
@@ -57,7 +60,10 @@ groups() ->
5760 set_policy_when_cmq_is_not_permitted_from_conf ]},
5861 {transient_nonexcl_queues , [],
5962 [when_transient_nonexcl_is_permitted_by_default ,
60- when_transient_nonexcl_is_not_permitted_from_conf ]}
63+ when_transient_nonexcl_is_not_permitted_from_conf ]},
64+ {queue_master_locator , [],
65+ [when_queue_master_locator_is_permitted_by_default ,
66+ when_queue_master_locator_is_not_permitted_from_conf ]}
6167 ],
6268 [{mnesia_store , [], Groups },
6369 {khepri_store , [], Groups }].
@@ -89,6 +95,8 @@ init_per_group(classic_queue_mirroring, Config) ->
8995 rabbit_ct_helpers :set_config (Config , {rmq_nodes_count , 1 });
9096init_per_group (transient_nonexcl_queues , Config ) ->
9197 rabbit_ct_helpers :set_config (Config , {rmq_nodes_count , 1 });
98+ init_per_group (queue_master_locator , Config ) ->
99+ rabbit_ct_helpers :set_config (Config , {rmq_nodes_count , 1 });
92100init_per_group (_Group , Config ) ->
93101 Config .
94102
@@ -125,6 +133,14 @@ init_per_testcase(
125133 [{permit_deprecated_features ,
126134 #{transient_nonexcl_queues => false }}]}),
127135 init_per_testcase1 (Testcase , Config1 );
136+ init_per_testcase (
137+ when_queue_master_locator_is_not_permitted_from_conf = Testcase , Config ) ->
138+ Config1 = rabbit_ct_helpers :merge_app_env (
139+ Config ,
140+ {rabbit ,
141+ [{permit_deprecated_features ,
142+ #{queue_master_locator => false }}]}),
143+ init_per_testcase1 (Testcase , Config1 );
128144init_per_testcase (Testcase , Config ) ->
129145 init_per_testcase1 (Testcase , Config ).
130146
@@ -454,6 +470,64 @@ when_transient_nonexcl_is_not_permitted_from_conf(Config) ->
454470 [" Deprecated features: `transient_nonexcl_queues`: Feature `transient_nonexcl_queues` is deprecated" ,
455471 " Its use is not permitted per the configuration" ])).
456472
473+ % % -------------------------------------------------------------------
474+ % % (x-)queue-master-locator
475+ % % -------------------------------------------------------------------
476+
477+ when_queue_master_locator_is_permitted_by_default (Config ) ->
478+ [NodeA ] = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
479+
480+ Ch = rabbit_ct_client_helpers :open_channel (Config , NodeA ),
481+
482+ QName = list_to_binary (atom_to_list (? FUNCTION_NAME )),
483+ ? assertEqual (
484+ {'queue.declare_ok' , QName , 0 , 0 },
485+ amqp_channel :call (
486+ Ch ,
487+ # 'queue.declare' {queue = QName ,
488+ arguments = [{<<" x-queue-master-locator" >>, longstr , <<" client-local" >>}]})),
489+
490+ ? assertEqual (
491+ ok ,
492+ rabbit_ct_broker_helpers :set_policy (
493+ Config , 0 , <<" client-local" >>, <<" .*" >>, <<" queues" >>, [{<<" queue-master-locator" >>, <<" client-local" >>}])),
494+
495+ ? assert (
496+ log_file_contains_message (
497+ Config , NodeA ,
498+ [" Deprecated features: `queue_master_locator`: queue-master-locator is deprecated. " ,
499+ " queue-leader-locator should be used instead." ])).
500+
501+ when_queue_master_locator_is_not_permitted_from_conf (Config ) ->
502+ [NodeA ] = rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
503+
504+ Ch = rabbit_ct_client_helpers :open_channel (Config , NodeA ),
505+
506+ QName = list_to_binary (atom_to_list (? FUNCTION_NAME )),
507+ ? assertExit (
508+ {{shutdown ,
509+ {connection_closing ,
510+ {server_initiated_close , 541 ,
511+ <<" INTERNAL_ERROR - Feature `queue_master_locator` is "
512+ " deprecated." , _ /binary >>}}}, _ },
513+ amqp_channel :call (
514+ Ch ,
515+ # 'queue.declare' {queue = QName ,
516+ arguments = [{<<" x-queue-master-locator" >>, longstr , <<" client-local" >>}]})),
517+
518+ ? assertError (
519+ {badmatch ,
520+ {error_string ,
521+ " Validation failed\n\n use of deprecated queue-master-locator argument is not permitted\n " }},
522+ rabbit_ct_broker_helpers :set_policy (
523+ Config , 0 , <<" client-local" >>, <<" .*" >>, <<" queues" >>, [{<<" queue-master-locator" >>, <<" client-local" >>}])),
524+
525+ ? assert (
526+ log_file_contains_message (
527+ Config , NodeA ,
528+ [" Deprecated features: `queue_master_locator`: Feature `queue_master_locator` is deprecated" ,
529+ " Its use is not permitted per the configuration" ])).
530+
457531% % -------------------------------------------------------------------
458532% % Helpers.
459533% % -------------------------------------------------------------------
0 commit comments