summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2010-02-03 22:30:20 +0000
committerMatthias Radestock <matthias@lshift.net>2010-02-03 22:30:20 +0000
commit02755e4d9928fe05c1a25e1ec44f3e16299b0dcb (patch)
tree3940c082f15ccb73210ecf1bb9c7c0fae7f312a5
parent2b94d25b8d0f99cbdad0a5ffae669d4439b3255a (diff)
downloadrabbitmq-server-02755e4d9928fe05c1a25e1ec44f3e16299b0dcb.tar.gz
automate testing of 'rabbitmqctl list_channels'
and add rabbit_channel:info_keys/0, in line with other info-providing modules
-rw-r--r--src/rabbit_channel.erl5
-rw-r--r--src/rabbit_tests.erl6
2 files changed, 10 insertions, 1 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 3cee196d..d0b0ee91 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -37,7 +37,7 @@
-export([start_link/5, do/2, do/3, shutdown/1]).
-export([send_command/2, deliver/4, conserve_memory/2]).
--export([list/0, info/1, info/2, info_all/0, info_all/1]).
+-export([list/0, info_keys/0, info/1, info/2, info_all/0, info_all/1]).
-export([init/1, terminate/2, code_change/3,
handle_call/3, handle_cast/2, handle_info/2, handle_pre_hibernate/1]).
@@ -77,6 +77,7 @@
-spec(deliver/4 :: (pid(), ctag(), boolean(), msg()) -> 'ok').
-spec(conserve_memory/2 :: (pid(), boolean()) -> 'ok').
-spec(list/0 :: () -> [pid()]).
+-spec(info_keys/0 :: () -> [info_key()]).
-spec(info/1 :: (pid()) -> [info()]).
-spec(info/2 :: (pid(), [info_key()]) -> [info()]).
-spec(info_all/0 :: () -> [[info()]]).
@@ -113,6 +114,8 @@ conserve_memory(Pid, Conserve) ->
list() ->
pg_local:get_members(rabbit_channels).
+info_keys() -> ?INFO_KEYS.
+
info(Pid) ->
gen_server2:pcall(Pid, 9, info, infinity).
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index 833ccc26..8b5467e6 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -717,6 +717,12 @@ test_server_status() ->
rabbit_networking:connection_info_keys(), false),
ok = gen_tcp:close(C),
+ %% list channels
+ Writer = spawn(fun () -> receive shutdown -> ok end end),
+ Ch = rabbit_channel:start_link(1, self(), Writer, <<"user">>, <<"/">>),
+ ok = info_action(list_channels, rabbit_channel:info_keys(), false),
+ ok = rabbit_channel:shutdown(Ch),
+
passed.
test_hooks() ->