diff options
| author | Daniil Fedotov <hairyhum@gmail.com> | 2018-03-06 13:53:54 +0000 |
|---|---|---|
| committer | Daniil Fedotov <hairyhum@gmail.com> | 2018-03-06 13:55:34 +0000 |
| commit | 00958e638574c9dca189fe5ae8d9def5bf4cf9c3 (patch) | |
| tree | 4831cf4b988cb13ad10c9db50381c482ed6a2f7b /test | |
| parent | 40f49fa4cee917b95eb0f154a6b41a4c40d4c856 (diff) | |
| download | rabbitmq-server-git-00958e638574c9dca189fe5ae8d9def5bf4cf9c3.tar.gz | |
Test that min-masters counts bound queues but not bindings
Diffstat (limited to 'test')
| -rw-r--r-- | test/queue_master_location_SUITE.erl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/queue_master_location_SUITE.erl b/test/queue_master_location_SUITE.erl index 457cf47b0c..48d9e0c5d1 100644 --- a/test/queue_master_location_SUITE.erl +++ b/test/queue_master_location_SUITE.erl @@ -56,6 +56,7 @@ groups() -> declare_policy_exactly, declare_config, calculate_min_master, + calculate_min_master_with_bindings, calculate_random, calculate_client_local ]} @@ -210,6 +211,22 @@ calculate_min_master(Config) -> verify_min_master(Config, Q), ok. +calculate_min_master_with_bindings(Config) -> + setup_test_environment(Config), + QueueName = rabbit_misc:r(<<"/">>, queue, Q = <<"qm.test_bound">>), + Args = [{<<"x-queue-master-locator">>, longstr, <<"min-masters">>}], + declare(Config, QueueName, false, false, Args, none), + verify_min_master(Config, Q), + % Do 20 bindings to this queue + [ bind(Config, QueueName, integer_to_binary(N)) || N <- lists:seq(1, 20) ], + + QueueName1 = rabbit_misc:r(<<"/">>, queue, Q1 = <<"qm.test_unbound">>), + declare(Config, QueueName1, false, false, Args, none), + % Another queue should still be on the same node, bindings should + % not account for min-masters counting + verify_min_master(Config, Q1), + ok. + calculate_random(Config) -> setup_test_environment(Config), QueueName = rabbit_misc:r(<<"/">>, queue, Q = <<"qm.test">>), @@ -314,6 +331,17 @@ declare(Config, QueueName, Durable, AutoDelete, Args0, Owner) -> {new, Queue} = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_amqqueue, declare, Args1), Queue. +bind(Config, QueueName, RoutingKey) -> + ExchangeName = rabbit_misc:r(QueueName, exchange, <<"amq.direct">>), + + ok = rabbit_ct_broker_helpers:rpc( + Config, 0, rabbit_binding, add, + [#binding{source = ExchangeName, + destination = QueueName, + key = RoutingKey, + args = []}, + <<"acting-user">>]). + verify_min_master(Config, Q, MinMasterNode) -> Rpc = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_queue_master_location_misc, |
