Skip to content

Commit

Permalink
KAZOO-929: Cleaned up rabbitmq-client test directory as a result of .…
Browse files Browse the repository at this point in the history
…gitignore rule.
  • Loading branch information
tickbw committed Jun 24, 2013
1 parent 3057d39 commit ce0bfbd
Show file tree
Hide file tree
Showing 7 changed files with 1,574 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ deps/erlydtl-0.7.0/src/erlydtl_parser.erl
deps/zucchini-1.0.0/src/zucchini_lexer.erl
deps/zucchini-1.0.0/src/zucchini_parser.erl
utils/sup/deps/getopt/
!deps/rabbitmq_client-2.8.6/test
deps/rabbitmq_client-2.8.6/deps.mk
deps/rabbitmq_client-2.8.6/deps/rabbit_common-0.0.0/include/gm_specs.hrl
deps/rabbitmq_client-2.8.6/deps/rabbit_common-0.0.0/include/rabbit.hrl
Expand Down
1 change: 1 addition & 0 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ROOT = ..
MAKEDIRS = rabbitmq_server-2.8.6/Makefile \
rabbitmq_client-2.8.6/Makefile \
lager-2.0.0rc1/Makefile \
ibrowse-4.0.1 \
*/Makefile

.PHONY: all compile clean $(MAKEDIRS)
Expand Down
33 changes: 33 additions & 0 deletions deps/rabbitmq_client-2.8.6/test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
# License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is RabbitMQ.
#
# The Initial Developer of the Original Code is VMware, Inc.
# Copyright (c) 2007-2013 VMware, Inc. All rights reserved.
#

TEST_SOURCES=$(wildcard *.erl)
TEST_TARGETS=$(patsubst %.erl, %.beam, $(TEST_SOURCES))
INCLUDES=$(wildcard ../$(INCLUDE_DIR)/*.hrl)
DEPS_DIR=../deps

ERLC_OPTS=-I ../$(INCLUDE_DIR) -o ./ -Wall -v +debug_info
LIBS_PATH=ERL_LIBS=$(DEPS_DIR)

all: compile

compile: $(TEST_TARGETS)

%.beam: %.erl $(DEPS_DIR)/$(COMMON_PACKAGE_DIR) $(INCLUDES)
$(LIBS_PATH) erlc $(ERLC_OPTS) $<

clean:
rm -f *.beam
123 changes: 123 additions & 0 deletions deps/rabbitmq_client-2.8.6/test/amqp_client_SUITE.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%%
%% The Original Code is RabbitMQ.
%%
%% The Initial Developer of the Original Code is VMware, Inc.
%% Copyright (c) 2007-2013 VMware, Inc. All rights reserved.
%%

-module(amqp_client_SUITE).

-export([test_coverage/0]).

-include_lib("eunit/include/eunit.hrl").

-define(FUNCTION,
begin
catch throw(x),
Fun = case erlang:get_stacktrace() of
[{_, F, _} | _] -> F; %% < R15
[{_, F, _, _} | _] -> F %% >= R15
end,
list_to_atom(string:strip(atom_to_list(Fun), right, $_))
end).

-define(RUN(Props), run(?FUNCTION, Props)).

%%---------------------------------------------------------------------------
%% Tests
%%---------------------------------------------------------------------------

amqp_uri_parse_test_() -> ?RUN([]).
route_destination_test_() -> ?RUN([]).
basic_get_test_() -> ?RUN([]).
basic_get_ipv6_test_() -> ?RUN([]).
basic_return_test_() -> ?RUN([]).
simultaneous_close_test_() -> ?RUN([repeat]).
basic_qos_test_() -> ?RUN([]).
basic_recover_test_() -> ?RUN([]).
basic_consume_test_() -> ?RUN([]).
consume_notification_test_() -> ?RUN([]).
basic_nack_test_() -> ?RUN([]).
large_content_test_() -> ?RUN([]).
lifecycle_test_() -> ?RUN([]).
direct_no_password_test_() -> ?RUN([]).
nowait_exchange_declare_test_() -> ?RUN([]).
channel_repeat_open_close_test_() -> ?RUN([]).
channel_multi_open_close_test_() -> ?RUN([]).
basic_ack_test_() -> ?RUN([]).
basic_ack_call_test_() -> ?RUN([]).
channel_lifecycle_test_() -> ?RUN([]).
queue_unbind_test_() -> ?RUN([]).
sync_method_serialization_test_() -> ?RUN([]).
async_sync_method_serialization_test_() -> ?RUN([]).
sync_async_method_serialization_test_() -> ?RUN([]).
teardown_test_() -> ?RUN([repeat]).
rpc_test_() -> ?RUN([]).
pub_and_close_test_() -> ?RUN([]).
channel_tune_negotiation_test_() -> ?RUN([]).
confirm_test_() -> ?RUN([]).
confirm_barrier_test_() -> ?RUN([]).
confirm_select_before_wait_test_() -> ?RUN([]).
confirm_barrier_timeout_test_() -> ?RUN([]).
confirm_barrier_die_timeout_test_() -> ?RUN([]).
default_consumer_test_() -> ?RUN([]).
subscribe_nowait_test_() -> ?RUN([]).

non_existent_exchange_test_() -> ?RUN([negative]).
bogus_rpc_test_() -> ?RUN([negative, repeat]).
hard_error_test_() -> ?RUN([negative, repeat]).
non_existent_user_test_() -> ?RUN([negative]).
invalid_password_test_() -> ?RUN([negative]).
non_existent_vhost_test_() -> ?RUN([negative]).
no_permission_test_() -> ?RUN([negative]).
channel_writer_death_test_() -> ?RUN([negative]).
channel_death_test_() -> ?RUN([negative]).
shortstr_overflow_property_test_() -> ?RUN([negative]).
shortstr_overflow_field_test_() -> ?RUN([negative]).
command_invalid_over_channel_test_() -> ?RUN([negative]).
command_invalid_over_channel0_test_() -> ?RUN([negative]).

%%---------------------------------------------------------------------------
%% Internal
%%---------------------------------------------------------------------------

run(TestName, Props) ->
RepeatCount = case proplists:get_value(repeat, Props, false) of
true -> 100;
Number when is_number(Number) -> Number;
false -> 1
end,
Module = case proplists:get_bool(negative, Props) of
true -> negative_test_util;
false -> test_util
end,
{timeout, proplists:get_value(timeout, Props, 60),
fun () ->
lists:foreach(
fun (_) ->
try erlang:apply(Module, TestName, []) of
Ret -> Ret
catch
exit:normal -> ok
end
end, lists:seq(1, RepeatCount))
end}.

%%---------------------------------------------------------------------------
%% Coverage
%%---------------------------------------------------------------------------

test_coverage() ->
rabbit_misc:enable_cover(),
test(),
rabbit_misc:report_cover().

122 changes: 122 additions & 0 deletions deps/rabbitmq_client-2.8.6/test/amqp_dbg.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%%
%% The Original Code is RabbitMQ.
%%
%% The Initial Developer of the Original Code is VMware, Inc.
%% Copyright (c) 2007-2013 VMware, Inc. All rights reserved.
%%

-module(amqp_dbg).

-include_lib("stdlib/include/ms_transform.hrl").

-export([tracer/0, all/0, c_all/0]).
-export([supervision/0, c_supervision/0,
connection_lifecycle/0, c_connection_lifecycle/0,
channels_manager_lifecycle/0, c_channels_manager_lifecycle/0,
channel_lifecycle/0, c_channel_lifecycle/0,
methods/0, c_methods/0]).


tracer() ->
Ret = dbg:tracer(),
{ok, _} = dbg:p(all, c),
Ret.

all() ->
tpl_list(all_args()).

c_all() ->
ctpl_list(all_args()).

supervision() ->
tpl_list(sup_args()).

c_supervision() ->
ctpl_list(sup_args()).

connection_lifecycle() ->
tpl_list(cl_args()).

c_connection_lifecycle() ->
ctpl_list(cl_args()).

channels_manager_lifecycle() ->
tpl_list(cml_args()).

c_channels_manager_lifecycle() ->
ctpl_list(cml_args()).

channel_lifecycle() ->
tpl_list(cl_args()).

c_channel_lifecycle() ->
ctpl_list(cl_args()).

methods() ->
tpl_list(m_args()).

c_methods() ->
ctpl_list(m_args()).

%%---------------------------------------------------------------------------
%% Internal plumbing
%%---------------------------------------------------------------------------

all_args() ->
sup_args() ++ ncl_args() ++ cml_args() ++ cl_args() ++
m_args().

sup_args() ->
[{amqp_connection_sup, start_link, return_ms()},
{amqp_connection_type_sup, start_link, return_ms()},
{amqp_channel_sup_sup, start_link, return_ms()},
{amqp_channel_sup_sup, start_channel_sup, return_ms()},
{amqp_channel_sup, start_link, return_ms()},
{amqp_network_connection, start_infrastructure, return_ms()},
{amqp_network_connection, start_heartbeat, return_ms()},
{amqp_channel, start_writer, return_ms()}].

ncl_args() ->
[{amqp_main_reader, start_link, return_ms()},
{amqp_gen_connection, set_closing_state, []},
{amqp_gen_connection, handle_channels_terminated, []},
{amqp_network_connection, connect, []},
{amqp_direct_connection, connect, []},
{amqp_gen_connection, terminate, []}].

cml_args() ->
[{amqp_channels_manager, handle_open_channel, return_ms()},
{amqp_channels_manager, handle_channel_down, []},
{amqp_channels_manager, signal_channels_connection_closing, []}].

cl_args() ->
[{amqp_channel, init, []},
{amqp_channel_util, open_channel, []},
{amqp_channel, terminate, []}].

m_args() ->
[{amqp_channel, do, return_ms()},
{amqp_channel, handle_method, []},
{amqp_gen_connection, handle_method, []},
{amqp_network_connection, do, return_ms()},
{amqp_network_connection, handshake_recv, return_ms()}].

tpl_list(ArgsList) ->
[{ok, _} = dbg:tpl(Module, Func, Ms) || {Module, Func, Ms} <- ArgsList],
ok.

ctpl_list(ArgsList) ->
[{ok, _} = dbg:ctpl(Module, Func) || {Module, Func, _} <- ArgsList],
ok.

return_ms() ->
dbg:fun2ms(fun(_) -> return_trace() end).
Loading

0 comments on commit ce0bfbd

Please sign in to comment.