Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile warnings in big tests #3297

Merged
merged 5 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ big_tests/src/mim_ct_rest.erl
big_tests/src/mim_ct_rest_handler.erl
big_tests/src/mim_ct_sup.erl
big_tests/priv/ssl
big_tests/tests/mongooseimctl_SUITE_data/roster.template
test_preset.log

codecov.json
Expand Down
2 changes: 1 addition & 1 deletion big_tests/src/ct_groups_summary_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ id(_Opts) ->

%% @doc Always called before any other callback function. Use this to initiate
%% any common state.
init(_Id, Opts) ->
init(_Id, _Opts) ->
%ct:pal("init opts: ~p", [Opts]),
{ok, #{total_ok => 0,
total_failed => 0,
Expand Down
11 changes: 5 additions & 6 deletions big_tests/src/ct_markdown_errors_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ post_init_per_suite(SuiteName, Config, Return, State) ->
State2 = handle_return(SuiteName, init_per_suite, Return, Config, State),
{Return, State2#state{suite = SuiteName}}.

post_init_per_group(GroupName, Config, Return, State=#state{suite = SuiteName}) ->
post_init_per_group(_GroupName, Config, Return, State=#state{suite = SuiteName}) ->
State2 = handle_return(SuiteName, init_per_group, Return, Config, State),
{Return, State2#state{}}.

Expand All @@ -46,7 +46,7 @@ post_end_per_suite(SuiteName, Config, Return, State) ->
State2 = handle_return(SuiteName, end_per_suite, Return, Config, State),
{Return, State2#state{suite = ''}}.

post_end_per_group(GroupName, Config, Return, State=#state{suite = SuiteName}) ->
post_end_per_group(_GroupName, Config, Return, State=#state{suite = SuiteName}) ->
State2 = handle_return(SuiteName, end_per_group, Return, Config, State),
{Return, State2#state{}}.

Expand Down Expand Up @@ -76,7 +76,7 @@ handle_return_unsafe(SuiteName, Place, Return, Config, State) ->
exec_limited_number_of_times(F, State)
end.

exec_limited_number_of_times(F, State=#state{limit=0, file=File,
exec_limited_number_of_times(_F, State=#state{limit=0, file=_File,
truncated_counter_file = TrFile}) ->
%% Log truncated, increment counter
TrCounter = old_truncated_counter_value(TrFile),
Expand All @@ -99,8 +99,8 @@ log_summary(SuiteName, GroupName, Place, #state{summary_file = SummaryFile}) ->
file:write_file(SummaryFile, [SummaryText, $\n], [append]),
ok.

log_error(SuiteName, GroupName, Place, Error, Config, #state{file = File, summary_file = SummaryFile}) ->
MaybeLogLink = make_log_link(Config),
log_error(SuiteName, GroupName, Place, Error, Config, #state{file = File, summary_file = _SummaryFile}) ->
_MaybeLogLink = make_log_link(Config),
LogLink = make_log_link(Config),
%% Spoler syntax
%% https://github.com/dear-github/dear-github/issues/166
Expand Down Expand Up @@ -132,7 +132,6 @@ make_summary_text(SuiteName, GroupName, TC) ->

make_log_link(Config) ->
LogFile = proplists:get_value(tc_logfile, Config, ""),
LogLink =
case LogFile of
"" ->
<<>>;
Expand Down
17 changes: 8 additions & 9 deletions big_tests/src/ct_mongoose_log_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pre_end_per_suite(_Suite,Config,State) ->
{Config, State#state{suite=no_suite}}.

%% @doc Called after end_per_suite.
post_end_per_suite(Suite,_Config,Return,State) ->
post_end_per_suite(_Suite,_Config,Return,State) ->
{Return, State}.

%% @doc Called before each init_per_group.
Expand All @@ -67,7 +67,7 @@ post_init_per_group(_Group,_Config,Return,State) ->
{Return, State}.

%% @doc Called after each end_per_group.
pre_end_per_group(Group,Config,State) ->
pre_end_per_group(_Group,Config,State) ->
{Config, State#state{group=no_group}}.

%% @doc Called after each end_per_group.
Expand Down Expand Up @@ -97,11 +97,11 @@ on_tc_fail(_TC, _Reason, State) ->

%% @doc Called when a test case is skipped by either user action
%% or due to an init function failing.
on_tc_skip(_TC, Reason, State) ->
on_tc_skip(_TC, _Reason, State) ->
State.

%% @doc Called when the scope of the CTH is done
terminate(State) ->
terminate(_State) ->
ok.


Expand Down Expand Up @@ -138,7 +138,7 @@ read_new_lines(Reader) ->
[]
end.

read_and_write_lines(Node, Reader, Writer, CurrentLineNum) when is_integer(CurrentLineNum) ->
read_and_write_lines(_Node, Reader, Writer, CurrentLineNum) when is_integer(CurrentLineNum) ->
Lines = read_new_lines(Reader),
write_lines(Lines, CurrentLineNum+1, Writer),
CurrentLineNum + length(Lines). % new current line
Expand Down Expand Up @@ -180,7 +180,7 @@ ensure_initialized(Config, State=#state{node=Node, cookie=Cookie, out_file=undef
[node(), Reader, node(Reader), Writer, OutFile]),
State#state{reader=Reader, writer=Writer, out_file=OutFile,
current_line_num=CurrentLineNum, url_file=UrlFile}
catch Class:Reason:Stacktrace ->
catch _Class:Reason:Stacktrace ->
ct:pal("issue=\"Failed to init ct_mongoose_log_hook\"~n node=~p~n "
"reason=~p~n stacktrace=~p",
[Node, Reason, Stacktrace]),
Expand Down Expand Up @@ -212,7 +212,6 @@ post_insert_line_numbers_into_report(State=#state{node=Node, reader=Reader, writ
current_line_num=CurrentLineNum, url_file=UrlFile,
group=Group, suite=Suite, priv_dir=PrivDir}, TC) ->
CurrentLineNum2 = read_and_write_lines(Node, Reader, Writer, CurrentLineNum),
Heading = atom_to_list(Node),
add_log_link_to_line(PrivDir, UrlFile, CurrentLineNum2, Node, " when finished"),
%% Write a message after the main part
Message = io_lib:format(
Expand All @@ -230,7 +229,7 @@ add_log_link_to_line(PrivDir, UrlFile, LogLine, Node, ExtraDescription) ->

%% Function `escalus_ct:add_log_link(Heading, URL, Type).'
%% allows to add simple links.
%%
%%
%% We can't add link with label (i.e. index.html#LABEL), because it would be escaped.
%% Let's create an HTML file for each link we want to insert, and insert our custom
%% redirect code inside.
Expand Down Expand Up @@ -263,7 +262,7 @@ open_file_without_linking(Node, File, Opts) ->
Res = rpc:block_call(Node, file, open, [File, Opts], 5000),
check_result(Node, File, Res).

check_result(Node, File, {ok, _} = Res) ->
check_result(_Node, _File, {ok, _} = Res) ->
Res;
check_result(Node, File, Res) ->
ct:fail({open_file_failed, Node, File, Res}).
Expand Down
2 changes: 1 addition & 1 deletion big_tests/src/ct_tty_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pre_init_per_testcase(TC,Config,State = #state{suite_total = Total})
when is_integer(Total) ->
print_case_enter(TC, State, "Starting"),
{Config, State#state{ ts = os:timestamp(), total = Total + 1 } };
pre_init_per_testcase(TC, Config, State) ->
pre_init_per_testcase(_TC, Config, State) ->
{Config, State}.

%% @doc Called after each test case.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, ejabberd_tests,
{application, mongoose_tests,
[
{description, ""},
{description, "MongooseIM big tests"},
{vsn, git},
{registered, []},
{applications, [
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/acc_e2e_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

-module(acc_e2e_SUITE).
-compile(export_all).
-compile(nowarn_export_all).
vkatsuba marked this conversation as resolved.
Show resolved Hide resolved

-include_lib("exml/include/exml.hrl").
-include_lib("escalus/include/escalus.hrl").
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/acc_e2e_SUITE_data/acc_test_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
-author("bartek").

-compile(export_all).
-compile(nowarn_export_all).

test_save_acc(#{ stanza := #{ type := <<"chat">>} } = Acc, _State) ->
Rand = rand:uniform(),
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/accounts_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-module(accounts_SUITE).
-compile(export_all).
-compile(nowarn_export_all).

-include_lib("escalus/include/escalus.hrl").
-include_lib("escalus/include/escalus_xmlns.hrl").
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/adhoc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
%%==============================================================================
-module(adhoc_SUITE).
-compile(export_all).
-compile(nowarn_export_all).

-include_lib("escalus/include/escalus.hrl").
-include_lib("common_test/include/ct.hrl").
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/amp_big_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
%% This work was sponsored by Grindr.com

-compile([export_all]).
-compile(nowarn_export_all).
-include_lib("common_test/include/ct.hrl").
-include_lib("escalus/include/escalus.hrl").
-include_lib("escalus/include/escalus_xmlns.hrl").
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/anonymous_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

-module(anonymous_SUITE).
-compile(export_all).
-compile(nowarn_export_all).

-include_lib("escalus/include/escalus.hrl").
-include_lib("common_test/include/ct.hrl").
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/bosh_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

-module(bosh_SUITE).
-compile(export_all).
-compile(nowarn_export_all).

-include_lib("escalus/include/escalus.hrl").
-include_lib("common_test/include/ct.hrl").
Expand Down
7 changes: 5 additions & 2 deletions big_tests/tests/bosh_interleave_reqs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

-export([test/1, sample/0, prop/1]).

-export([initial_state/1, command/1, precondition/2, postcondition/3,
-export([initial_state/0, initial_state/1, command/1, precondition/2, postcondition/3,
next_state/3]).

-export([read_config/1,
Expand Down Expand Up @@ -63,6 +63,9 @@ maybe_stop_client(Client) ->
ct:pal("There was timeout ~p when stopping ~p", [Details, Client])
end.

initial_state() ->
#state{}.

initial_state(Pid) ->
#state{carol = undefined,
alice = undefined,
Expand Down Expand Up @@ -157,7 +160,7 @@ wait_for_msgs_carol(Carol, Msgs) ->
wait_for_msgs_alice(Alice, Msgs) ->
wait_for_msgs(Alice, lists:reverse(Msgs)).

wait_for_msgs(Client, []) ->
wait_for_msgs(_Client, []) ->
ok;
wait_for_msgs(Client, All) ->
StanzasFromServer = escalus:wait_for_stanzas(Client, length(All), timer:seconds(5)),
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/carboncopy_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-module(carboncopy_SUITE).

-compile([export_all]).
-compile(nowarn_export_all).
-include_lib("common_test/include/ct.hrl").
-include_lib("proper/include/proper.hrl").
-include_lib("eunit/include/eunit.hrl").
Expand Down
3 changes: 2 additions & 1 deletion big_tests/tests/cluster_commands_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

-module(cluster_commands_SUITE).
-compile(export_all).
-compile(nowarn_export_all).

-import(distributed_helper, [add_node_to_cluster/2,
is_sm_distributed/0,
Expand Down Expand Up @@ -390,7 +391,7 @@ remove_dead_from_cluster(Config) ->
% given
Timeout = timer:seconds(60),
#{node := Node1Nodename} = Node1 = mim(),
#{node := Node2Nodename} = Node2 = mim2(),
#{node := _Node2Nodename} = Node2 = mim2(),
#{node := Node3Nodename} = Node3 = mim3(),
ok = rpc(Node2#{timeout => Timeout}, mongoose_cluster, join, [Node1Nodename]),
ok = rpc(Node3#{timeout => Timeout}, mongoose_cluster, join, [Node1Nodename]),
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/common_helper.erl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-module(common_helper).
-compile(export_all).

-compile(nowarn_export_all).

get_bjid(UserSpec) ->
User = proplists:get_value(username, UserSpec),
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/component_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

-module(component_SUITE).
-compile(export_all).
-compile(nowarn_export_all).

-include_lib("escalus/include/escalus.hrl").
-include_lib("common_test/include/ct.hrl").
Expand Down
5 changes: 2 additions & 3 deletions big_tests/tests/connect_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
-module(connect_SUITE).

-compile(export_all).
-compile(nowarn_export_all).

-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
Expand Down Expand Up @@ -172,8 +173,6 @@ init_per_group(just_tls,Config)->
[{tls_module, just_tls} | Config];
init_per_group(fast_tls,Config)->
[{tls_module, fast_tls} | Config];
init_per_group(session_replacement, Config) ->
Config;
init_per_group(proxy_protocol, Config) ->
config_ejabberd_node_c2s(Config, [{proxy_protocol, true}]),
Config;
Expand Down Expand Up @@ -722,7 +721,7 @@ connect_with_proxy_header(Config) ->
%% WHEN
ConnectionSteps = [{?MODULE, send_proxy_header}, start_stream, stream_features,
authenticate, bind, session],
{ok, Conn, Features} = escalus_connection:start(UserSpec, ConnectionSteps),
{ok, Conn, _Features} = escalus_connection:start(UserSpec, ConnectionSteps),
% make sure the session is present
escalus:send(Conn, escalus_stanza:presence(<<"available">>)),
escalus:assert(is_presence, escalus:wait_for_stanza(Conn)),
Expand Down
3 changes: 2 additions & 1 deletion big_tests/tests/disco_and_caps_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-module(disco_and_caps_SUITE).
-compile(export_all).
-compile(nowarn_export_all).

-include_lib("eunit/include/eunit.hrl").
-include_lib("escalus/include/escalus_xmlns.hrl").
Expand Down Expand Up @@ -44,7 +45,7 @@ init_per_group(Name, C) ->
dynamic_modules:ensure_modules(host_type(), required_modules(Name)),
C2.

end_per_group(Name, C) ->
end_per_group(_Name, C) ->
dynamic_modules:restore_modules(host_type(), C).

init_per_testcase(Name, C) ->
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/distributed_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-import(ejabberd_node_utils, [get_cwd/2]).

-compile(export_all).
-compile(nowarn_export_all).

-type rpc_spec() :: #{node := node(),
cookie => atom(),
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/domain_isolation_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
-include_lib("eunit/include/eunit.hrl").

-compile(export_all).
-compile(nowarn_export_all).
-import(distributed_helper, [mim/0, require_rpc_nodes/1, rpc/4, subhost_pattern/1]).
-import(domain_helper, [host_type/0, secondary_host_type/0]).

Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/domain_removal_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-module(domain_removal_SUITE).

-compile(export_all).
-compile(nowarn_export_all).

-import(distributed_helper, [mim/0, rpc/4, subhost_pattern/1]).
-import(domain_helper, [host_type/0, domain/0]).
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/dynamic_domains_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

%% API
-compile(export_all).
-compile(nowarn_export_all).
-import(distributed_helper, [mim/0, mim2/0, rpc/4,
require_rpc_nodes/1,
subhost_pattern/1]).
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/extdisco_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
-define(NS_EXTDISCO, <<"urn:xmpp:extdisco:2">>).

-compile([export_all]).
-compile(nowarn_export_all).

all() ->
[{group, extdisco_not_configured},
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/jingle_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-module(jingle_SUITE).
-compile(export_all).
-compile(nowarn_export_all).

-include_lib("common_test/include/ct.hrl").
-include_lib("exml/include/exml.hrl").
Expand Down
Loading