@@ -56,6 +56,7 @@ groups() ->
5656 declare_policy_exactly ,
5757 declare_config ,
5858 calculate_min_master ,
59+ calculate_min_master_with_bindings ,
5960 calculate_random ,
6061 calculate_client_local
6162 ]}
@@ -210,6 +211,22 @@ calculate_min_master(Config) ->
210211 verify_min_master (Config , Q ),
211212 ok .
212213
214+ calculate_min_master_with_bindings (Config ) ->
215+ setup_test_environment (Config ),
216+ QueueName = rabbit_misc :r (<<" /" >>, queue , Q = <<" qm.test_bound" >>),
217+ Args = [{<<" x-queue-master-locator" >>, longstr , <<" min-masters" >>}],
218+ declare (Config , QueueName , false , false , Args , none ),
219+ verify_min_master (Config , Q ),
220+ % Do 20 bindings to this queue
221+ [ bind (Config , QueueName , integer_to_binary (N )) || N <- lists :seq (1 , 20 ) ],
222+
223+ QueueName1 = rabbit_misc :r (<<" /" >>, queue , Q1 = <<" qm.test_unbound" >>),
224+ declare (Config , QueueName1 , false , false , Args , none ),
225+ % Another queue should still be on the same node, bindings should
226+ % not account for min-masters counting
227+ verify_min_master (Config , Q1 ),
228+ ok .
229+
213230calculate_random (Config ) ->
214231 setup_test_environment (Config ),
215232 QueueName = rabbit_misc :r (<<" /" >>, queue , Q = <<" qm.test" >>),
@@ -314,6 +331,17 @@ declare(Config, QueueName, Durable, AutoDelete, Args0, Owner) ->
314331 {new , Queue } = rabbit_ct_broker_helpers :rpc (Config , 0 , rabbit_amqqueue , declare , Args1 ),
315332 Queue .
316333
334+ bind (Config , QueueName , RoutingKey ) ->
335+ ExchangeName = rabbit_misc :r (QueueName , exchange , <<" amq.direct" >>),
336+
337+ ok = rabbit_ct_broker_helpers :rpc (
338+ Config , 0 , rabbit_binding , add ,
339+ [# binding {source = ExchangeName ,
340+ destination = QueueName ,
341+ key = RoutingKey ,
342+ args = []},
343+ <<" acting-user" >>]).
344+
317345verify_min_master (Config , Q , MinMasterNode ) ->
318346 Rpc = rabbit_ct_broker_helpers :rpc (Config , 0 ,
319347 rabbit_queue_master_location_misc ,
0 commit comments