Skip to content

Commit

Permalink
Merge 2167198 into 2c6a43d
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides authored Oct 17, 2019
2 parents 2c6a43d + 2167198 commit a3ddf3b
Show file tree
Hide file tree
Showing 53 changed files with 198 additions and 265 deletions.
24 changes: 5 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,6 @@ workflows:
context: mongooseim-org
filters: *all_tags
# ============= BASE BUILDS =============
- mim/build:
name: otp_20_3
otp_package: 1:20.3.8.22-1
context: mongooseim-org
filters: *all_tags
- mim/build:
name: otp_21_3
otp_package: 1:21.3.8.6-1
Expand All @@ -321,13 +316,6 @@ workflows:
context: mongooseim-org
filters: *all_tags
# ============= SMALL TESTS =============
- mim/small_tests:
name: small_tests_20_3
otp_package: 1:20.3.8.22-1
context: mongooseim-org
requires:
- otp_20_3
filters: *all_tags
- mim/small_tests:
name: small_tests_21_3
otp_package: 1:21.3.8.6-1
Expand Down Expand Up @@ -395,25 +383,24 @@ workflows:
requires:
- otp_22
filters: *all_tags
# ============= 1 VERSION OLDER TESTS =============
- mim/big_tests:
name: pgsql_mnesia
otp_package: 1:21.3.8.6-1
otp_package: 1:22.0.7-1
preset: pgsql_mnesia
db: pgsql
context: mongooseim-org
requires:
- otp_21_3
- otp_22
filters: *all_tags
# ============= 2 VERSIONS OLDER TESTS =============
# ============= 1 VERSIONS OLDER TESTS =============
- mim/big_tests:
name: ldap_mnesia
otp_package: 1:20.3.8.22-1
otp_package: 1:21.3.8.6-1
preset: ldap_mnesia
db: mnesia
context: mongooseim-org
requires:
- otp_20_3
- otp_21_3
filters: *all_tags
# ============= DOCKER IMAGE BUILD & UPLOAD =============
- mim/docker_image:
Expand All @@ -431,5 +418,4 @@ workflows:
- dialyzer
- small_tests_22
- small_tests_21_3
- small_tests_20_3
filters: *all_tags
7 changes: 3 additions & 4 deletions big_tests/run_common_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ main(RawArgs) ->
io:format("Exiting by groups summary: ~p~n", [ExitStatusByGroups]),
init:stop(ExitStatusByGroups)
end
catch Type:Reason ->
Stacktrace = erlang:get_stacktrace(),
catch Type:Reason:StackTrace ->
io:format("TEST CRASHED~n Error type: ~p~n Reason: ~p~n Stacktrace:~n~p~n",
[Type, Reason, Stacktrace]),
[Type, Reason, StackTrace]),
error_logger:error_msg("TEST CRASHED~n Error type: ~p~n Reason: ~p~n Stacktrace:~n~p~n",
[Type, Reason, Stacktrace]),
[Type, Reason, StackTrace]),
%% Waiting for messages to be flushed
timer:sleep(5000),
init:stop("run_common_test:main/1 crashed")
Expand Down
5 changes: 2 additions & 3 deletions big_tests/src/ct_markdown_errors_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ post_end_per_testcase(TC, Config, Return, State=#state{suite = SuiteName}) ->

handle_return(SuiteName, Place, Return, Config, State) ->
try handle_return_unsafe(SuiteName, Place, Return, Config, State)
catch Class:Error ->
Stacktrace = erlang:get_stacktrace(),
catch Class:Error:StackTrace ->
ct:pal("issue=handle_return_unsafe_failed reason=~p:~p~n"
"stacktrace=~p", [Class, Error, Stacktrace]),
"stacktrace=~p", [Class, Error, StackTrace]),
State
end.

Expand Down
4 changes: 2 additions & 2 deletions big_tests/tests/gdpr_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1588,11 +1588,11 @@ validate_personal_data(Dir, FilePrefix, ExpectedHeader, ExpectedItems, SortBy) -
try validate_personal_maps(PersonalMaps, ExpectedItems) of
_ -> ok
catch
C:R ->
C:R:S ->
ct:fail(#{
class => C,
reason => R,
stacktrace => erlang:get_stacktrace(),
stacktrace => S,
sorted_by => SortBy,
personal_maps => PersonalMaps,
expected_items => ExpectedItems
Expand Down
4 changes: 2 additions & 2 deletions big_tests/tests/inbox_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ check_inbox(Client, Convs, QueryOpts, CheckOpts) ->
try
check_inbox_result(Client, CheckOpts, ResultStanzas, ExpectedSortedConvs)
catch
_:Reason ->
_:Reason:StackTrace ->
ct:fail(#{ reason => inbox_mismatch,
inbox_items => lists:map(fun exml:to_binary/1, ResultStanzas),
expected_items => lists:map(fun pretty_conv/1, ExpectedSortedConvs),
query_params => QueryOpts,
check_params => CheckOpts,
error => Reason,
stacktrace => erlang:get_stacktrace() })
stacktrace => StackTrace })
end.

check_inbox_result(Client, CheckOpts, ResultStanzas, MsgCheckList) ->
Expand Down
10 changes: 4 additions & 6 deletions big_tests/tests/mam_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1695,10 +1695,9 @@ archived(Config) ->
#forwarded_message{result_id=ArcId} = parse_forwarded_message(ArcMsg),
?assert_equal(Id, ArcId),
ok
catch Class:Reason ->
Stacktrace = erlang:get_stacktrace(),
catch Class:Reason:StackTrace ->
ct:pal("Msg ~p", [Msg]),
erlang:raise(Class, Reason, Stacktrace)
erlang:raise(Class, Reason, StackTrace)
end
end,
%% Made fresh in init_per_testcase
Expand Down Expand Up @@ -2776,10 +2775,9 @@ mam_service_discovery(Config) ->
escalus:assert(is_iq_result, Stanza),
escalus:assert(has_feature, [mam_ns_binary_v03()], Stanza),
ok
catch Class:Reason ->
Stacktrace = erlang:get_stacktrace(),
catch Class:Reason:StackTrace ->
ct:pal("Stanza ~p.", [Stanza]),
erlang:raise(Class, Reason, Stacktrace)
erlang:raise(Class, Reason, StackTrace)
end
end,
escalus_fresh:story(Config, [{alice, 1}], F).
Expand Down
15 changes: 6 additions & 9 deletions big_tests/tests/mam_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -862,14 +862,13 @@ wait_message_range(P, Client, TotalCount, Offset, FromN, ToN) ->
?assert_equal([generate_message_text(N) || N <- lists:seq(FromN, ToN)],
[B || #forwarded_message{message_body=B} <- ParsedMessages]),
ok
catch Class:Reason ->
Stacktrace = erlang:get_stacktrace(),
catch Class:Reason:StackTrace ->
ct:pal("IQ: ~p~n"
"Fin: ~p~n"
"Messages: ~p~n"
"Parsed messages: ~p~n",
[IQ, Fin, Messages, ParsedMessages]),
erlang:raise(Class, Reason, Stacktrace)
erlang:raise(Class, Reason, StackTrace)
end.


Expand All @@ -881,18 +880,16 @@ wait_empty_rset(P, Alice, TotalCount) ->
try
?assert_equal(TotalCount, ParsedIQ#result_iq.count),
ok
catch Class:Reason ->
Stacktrace = erlang:get_stacktrace(),
catch Class:Reason:StackTrace ->
ct:pal("IQ: ~p~n", [IQ]),
erlang:raise(Class, Reason, Stacktrace)
erlang:raise(Class, Reason, StackTrace)
end.

parse_messages(Messages) ->
try [parse_forwarded_message(M) || M <- Messages]
catch Class:Reason ->
Stacktrace = erlang:get_stacktrace(),
catch Class:Reason:StackTrace ->
ct:pal("Messages: ~p~n", [Messages]),
erlang:raise(Class, Reason, Stacktrace)
erlang:raise(Class, Reason, StackTrace)
end.

bootstrap_archive(Config) ->
Expand Down
10 changes: 4 additions & 6 deletions big_tests/tests/muc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4529,10 +4529,9 @@ wait_room_range(Client, TotalCount, Offset, FromN, ToN) ->
?assert_equal(generate_room_name(ToN), Out#rsm_out.last),
?assert_equal(generate_room_addrs(FromN, ToN), room_jids(Out)),
ok
catch Class:Reason ->
Stacktrace = erlang:get_stacktrace(),
catch Class:Reason:StackTrace ->
ct:pal("IQ: ~p~nOut: ~p~n", [IQ, Out]),
erlang:raise(Class, Reason, Stacktrace)
erlang:raise(Class, Reason, StackTrace)
end.

wait_empty_rset(Client, TotalCount) ->
Expand All @@ -4542,10 +4541,9 @@ wait_empty_rset(Client, TotalCount) ->
?assert_equal(i2b(TotalCount), Out#rsm_out.count),
?assert_equal([], room_jids(Out)),
ok
catch Class:Reason ->
Stacktrace = erlang:get_stacktrace(),
catch Class:Reason:StackTrace ->
ct:pal("IQ: ~p~nOut: ~p~n", [IQ, Out]),
erlang:raise(Class, Reason, Stacktrace)
erlang:raise(Class, Reason, StackTrace)
end.

room_jids(#rsm_out{items=Items}) ->
Expand Down
5 changes: 2 additions & 3 deletions big_tests/tests/pubsub_tools.erl
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,9 @@ check_node_creation_notification(Response, NodeName) ->
check_item_notification(Response, ItemId, {NodeAddr, NodeName}, Options) ->
try
do_check_item_notification(Response, ItemId, {NodeAddr, NodeName}, Options)
catch Class:Reason ->
catch Class:Reason:StackTrace ->
ct:pal("failed to check response=~p", [Response]),
Stacktrace = erlang:get_stacktrace(),
erlang:raise(Class, Reason, Stacktrace)
erlang:raise(Class, Reason, StackTrace)
end,
Response.

Expand Down
7 changes: 3 additions & 4 deletions doc/developers-guide/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ and [ELK](https://www.elastic.co/elk-stack) friendly.

try ...
catch
Class:Reason ->
Stacktrace = erlang:get_stacktrace(),
Class:Reason:StackTrace ->
?ERROR_MSG("event=check_password_failed "
"reason=~p:~p user=~ts stacktrace=~1000p",
[Class, Reason, LUser, Stacktrace]),
erlang:raise(Class, Reason, Stacktrace)
[Class, Reason, LUser, StackTrace]),
erlang:raise(Class, Reason, StackTrace)
end
```

Expand Down
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
%% This plugin dowloads zips from github and caches them
%% This plugin is totally optional and everything would work without it (just slower)
{rebar_faster_deps, {git, "https://github.com/arcusfelis/rebar3-faster-deps-plugin.git",
{ref, "eb3cded5b050edd82cf8653f8c850c6c9890f732"}}},
{ref, "425c75af169f40b9c1c9e471b941175c4530374f"}}},
{pc, {git, "https://github.com/blt/port_compiler.git", {ref, "c2f3fb1"}}},
{provider_asn1, {git, "https://github.com/knusbaum/provider_asn1.git", {ref, "29f7850"}}},
{rebar3_codecov, {git, "https://github.com/zofpolkowska/rebar3_codecov.git", {ref, "b539c5c"}}},
Expand Down
12 changes: 6 additions & 6 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{<<"backoff">>,{pkg,<<"backoff">>,<<"1.1.3">>},1},
{<<"base16">>,{pkg,<<"base16">>,<<"1.0.0">>},0},
{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.6.1">>},0},
{<<"bear">>,{pkg,<<"bear">>,<<"0.8.5">>},1},
{<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},1},
{<<"cache_tab">>,{pkg,<<"cache_tab">>,<<"1.0.19">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.3.1">>},2},
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.6.3">>},0},
Expand Down Expand Up @@ -40,7 +40,7 @@
0},
{<<"exometer_core">>,
{git,"https://github.com/esl/exometer_core.git",
{ref,"40928fa450e6d5a9497aa42b39b55332a7998cb7"}},
{ref,"6303e88d753f2a9c0ac4d7a5ba0151b765290a46"}},
0},
{<<"exometer_report_graphite">>,
{git,"https://github.com/esl/exometer_report_graphite.git",
Expand Down Expand Up @@ -80,7 +80,7 @@
{<<"lhttpc">>,{pkg,<<"lhttpc">>,<<"1.6.2">>},1},
{<<"luerl">>,
{git,"https://github.com/rvirding/luerl.git",
{ref,"4a4aaed06afcbbe7601a6a939ebbe31293c856dc"}},
{ref,"ebbf122a6b39e4e33d72366719888db79ea5f875"}},
2},
{<<"lz4">>,
{git,"https://github.com/szktty/erlang-lz4.git",
Expand Down Expand Up @@ -112,7 +112,7 @@
{git,"https://github.com/erszcz/pa.git",
{ref,"48762a4bdd958334324b48985b30d8bb82c1b5e2"}},
0},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.1.0">>},1},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},1},
{<<"pooler">>,{pkg,<<"pooler">>,<<"1.5.3">>},1},
{<<"proper">>,{pkg,<<"proper">>,<<"1.3.0">>},0},
{<<"quickrand">>,{pkg,<<"quickrand">>,<<"1.7.5">>},1},
Expand Down Expand Up @@ -160,7 +160,7 @@
{<<"backoff">>, <<"DE762C05ED6DFAE862D83DC9E58AE936792B01302B3595F5CFFE86F2D8E6C1DD">>},
{<<"base16">>, <<"283644E2B21BD5915ACB7178BED7851FB07C6E5749B8FAD68A53C501092176D9">>},
{<<"bbmustache">>, <<"9FB63FA60BD53AFBF47F02E6D8BD6B2BEAFC068E02E20975254DC7461FD4F397">>},
{<<"bear">>, <<"E95FCA1627CD9E15BAF93CE0A52AFF16917BAF325F0EE65B88CD715376CD2344">>},
{<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>},
{<<"cache_tab">>, <<"9409B890B9526AFBFEEEA1CD191DEC5BB9D4B0089AF3684F58CBB7FD88457546">>},
{<<"certifi">>, <<"D0F424232390BF47D82DA8478022301C561CF6445B5B5FB6A84D49A9E76D2639">>},
{<<"cowboy">>, <<"99AA50E94E685557CAD82E704457336A453D4ABCB77839AD22DBE71F311FCC06">>},
Expand Down Expand Up @@ -189,7 +189,7 @@
{<<"mysql">>, <<"5A0B8C8947A5D74E2F61C0DDDCDF94E1A63056060E26B50BE888BFF81736BE9E">>},
{<<"observer_cli">>, <<"9944882B71F55B2503663D9CB54D3F1C7BBDF7CC6DD01CC40EA8EF51207601EC">>},
{<<"p1_utils">>, <<"731F76AE1F31F4554AFB2AE629CB5589D53BD13EFC72B11F5A7C3B1242F91046">>},
{<<"parse_trans">>, <<"1BAD3B959941CC53FFD6F4769A5D2666F9CDF179B2D62826636497D3FBAD9EC0">>},
{<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>},
{<<"pooler">>, <<"898CD1FA301FC42D4A8ED598CE139B71CA85B54C16AB161152B5CC5FBDCFA1A8">>},
{<<"proper">>, <<"C1ACD51C51DA17A2FE91D7A6FC6A0C25A6A9849D8DC77093533109D1218D8457">>},
{<<"quickrand">>, <<"E3086A153EB13A057FC19192D05E2D4C6BB2BDBB55746A699BEAE9847AC17CA8">>},
Expand Down
Loading

0 comments on commit a3ddf3b

Please sign in to comment.