diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-01-24 14:04:42 +0100 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-01-24 14:04:42 +0100 |
| commit | 3ec8ffffe780d66c451da07a6e35b78d93fa0bd2 (patch) | |
| tree | cefe4cd62011a9763d9569fcb628b21eb4eb9e42 /test | |
| parent | d0fd11fff9ae41d2b649f8b250f49bc71ed9843c (diff) | |
| download | rabbitmq-server-git-3ec8ffffe780d66c451da07a6e35b78d93fa0bd2.tar.gz | |
backing_queue_SUITE:: Move `get_queue_sup_pid()` from rabbitmq-ct-helpers
This is the only place this function is used and this removes a
dependency cycle: rabbit_ct_broker_helpers can't depend on the broker:
the broker already depends on it as a test dependency.
[#159298729]
Diffstat (limited to 'test')
| -rw-r--r-- | test/backing_queue_SUITE.erl | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/backing_queue_SUITE.erl b/test/backing_queue_SUITE.erl index 5864c387c5..433bc66bff 100644 --- a/test/backing_queue_SUITE.erl +++ b/test/backing_queue_SUITE.erl @@ -723,7 +723,7 @@ bq_queue_recover1(Config) -> true, false, [], none, <<"acting-user">>), publish_and_confirm(Q, <<>>, Count), - SupPid = rabbit_ct_broker_helpers:get_queue_sup_pid(Q), + SupPid = get_queue_sup_pid(Q), true = is_pid(SupPid), exit(SupPid, kill), exit(QPid, kill), @@ -751,6 +751,22 @@ bq_queue_recover1(Config) -> end), passed. +%% Return the PID of the given queue's supervisor. +get_queue_sup_pid(#amqqueue { pid = QPid, name = QName }) -> + VHost = QName#resource.virtual_host, + {ok, AmqSup} = rabbit_amqqueue_sup_sup:find_for_vhost(VHost, node(QPid)), + Sups = supervisor:which_children(AmqSup), + get_queue_sup_pid(Sups, QPid). + +get_queue_sup_pid([{_, SupPid, _, _} | Rest], QueuePid) -> + WorkerPids = [Pid || {_, Pid, _, _} <- supervisor:which_children(SupPid)], + case lists:member(QueuePid, WorkerPids) of + true -> SupPid; + false -> get_queue_sup_pid(Rest, QueuePid) + end; +get_queue_sup_pid([], _QueuePid) -> + undefined. + variable_queue_dynamic_duration_change(Config) -> passed = rabbit_ct_broker_helpers:rpc(Config, 0, ?MODULE, variable_queue_dynamic_duration_change1, [Config]). |
