summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-02-03 12:52:18 +0000
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-02-03 12:52:18 +0000
commit847429d175b14d64eb758c3812711532fd57c679 (patch)
treee820b6aa9bc4085a0b907a59ec6e7cbd037b5379
parentd42396d94bdeffa7e5b323df981e40d912b32341 (diff)
downloadrabbitmq-server-847429d175b14d64eb758c3812711532fd57c679.tar.gz
add test
-rw-r--r--src/rabbit_amqqueue.erl3
-rw-r--r--src/rabbit_node_monitor.erl2
-rw-r--r--src/rabbit_tests.erl40
3 files changed, 39 insertions, 6 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index a6da551d..2545b07c 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -356,7 +356,8 @@ consumers_all(VHostPath) ->
{ChPid, ConsumerTag, AckRequired} <- consumers(Q)]
end)).
-stat(#amqqueue{pid = QPid}) -> delegate_call(QPid, stat, infinity).
+stat(#amqqueue{pid = QPid}) ->
+ delegate_call(QPid, stat, infinity).
emit_stats(#amqqueue{pid = QPid}) ->
delegate_cast(QPid, emit_stats).
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl
index f372fbdd..2c1e4b16 100644
--- a/src/rabbit_node_monitor.erl
+++ b/src/rabbit_node_monitor.erl
@@ -52,7 +52,7 @@ notify_cluster() ->
?RABBIT_UP_RPC_TIMEOUT),
case BadNodes of
[] -> ok;
- _ -> rabbit_log:warn("failed to contact nodes ~p", [BadNodes])
+ _ -> rabbit_log:info("failed to contact nodes ~p", [BadNodes])
end,
%% register other active rabbits with this rabbit
[ rabbit_node_monitor:rabbit_running_on(Node)
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index 49b09508..ddb53b15 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -26,6 +26,7 @@
-define(PERSISTENT_MSG_STORE, msg_store_persistent).
-define(TRANSIENT_MSG_STORE, msg_store_transient).
+-define(CLEANUP_QUEUE_NAME, <<"cleanup-queue">>).
test_content_prop_roundtrip(Datum, Binary) ->
Types = [element(1, E) || E <- Datum],
@@ -80,19 +81,21 @@ run_cluster_dependent_tests(SecondaryNode) ->
io:format("Running cluster dependent tests with node ~p~n", [SecondaryNode]),
passed = test_delegates_async(SecondaryNode),
passed = test_delegates_sync(SecondaryNode),
+ passed = test_queue_cleanup(SecondaryNode),
%% we now run the tests remotely, so that code coverage on the
%% local node picks up more of the delegate
Node = node(),
Self = self(),
Remote = spawn(SecondaryNode,
- fun () -> A = test_delegates_async(Node),
- B = test_delegates_sync(Node),
- Self ! {self(), {A, B}}
+ fun () -> Rs = [ test_delegates_async(Node),
+ test_delegates_sync(Node),
+ test_queue_cleanup(Node) ],
+ Self ! {self(), Rs}
end),
receive
{Remote, Result} ->
- Result = {passed, passed}
+ Result = [passed, passed, passed]
after 2000 ->
throw(timeout)
end,
@@ -1278,6 +1281,35 @@ test_delegates_sync(SecondaryNode) ->
passed.
+test_queue_cleanup_receiver(Pid) ->
+ receive
+ shutdown ->
+ ok;
+ {send_command, Method} ->
+ Pid ! Method,
+ test_queue_cleanup_receiver(Pid)
+ end.
+
+
+test_queue_cleanup(_SecondaryNode) ->
+ {_Writer, Ch} = test_spawn(fun test_queue_cleanup_receiver/1),
+ rabbit_channel:do(Ch, #'queue.declare'{ queue = ?CLEANUP_QUEUE_NAME }),
+ receive #'queue.declare_ok'{queue = ?CLEANUP_QUEUE_NAME} ->
+ ok
+ after 1000 -> throw(failed_to_receive_queue_declare_ok)
+ end,
+ rabbit:stop(),
+ rabbit:start(),
+ rabbit_channel:do(Ch, #'queue.declare'{ passive = true,
+ queue = ?CLEANUP_QUEUE_NAME }),
+ receive
+ {channel_exit, 1, {amqp_error, not_found, _, _}} ->
+ ok
+ after 2000 ->
+ throw(failed_to_receive_channel_exit)
+ end,
+ passed.
+
%---------------------------------------------------------------------
control_action(Command, Args) ->