mirror of
https://github.com/processone/ejabberd
synced 2025-10-05 10:39:29 +02:00
Test suite cleanup.
* Split test cases in groups. * Increase a loglevel of common_test framework.
This commit is contained in:
parent
b50a4948ed
commit
7b96d8cc24
3 changed files with 43 additions and 47 deletions
|
@ -251,7 +251,7 @@ dialyzer: plt
|
||||||
--get_warnings -o dialyzer.log ebin
|
--get_warnings -o dialyzer.log ebin
|
||||||
|
|
||||||
test:
|
test:
|
||||||
$(REBAR) skip_deps=true ct
|
$(REBAR) -v skip_deps=true ct
|
||||||
|
|
||||||
.PHONY: src doc edoc dialyzer Makefile TAGS clean clean-rel distclean rel plt \
|
.PHONY: src doc edoc dialyzer Makefile TAGS clean clean-rel distclean rel plt \
|
||||||
install uninstall uninstall-binary uninstall-all translations deps test spec
|
install uninstall uninstall-binary uninstall-all translations deps test spec
|
||||||
|
|
|
@ -43,24 +43,23 @@ init_per_suite(Config) ->
|
||||||
application:set_env(ejabberd, log_path, LogPath),
|
application:set_env(ejabberd, log_path, LogPath),
|
||||||
application:set_env(sasl, sasl_error_logger, {file, SASLPath}),
|
application:set_env(sasl, sasl_error_logger, {file, SASLPath}),
|
||||||
application:set_env(mnesia, dir, MnesiaDir),
|
application:set_env(mnesia, dir, MnesiaDir),
|
||||||
|
ok = application:start(ejabberd),
|
||||||
[{server, <<"localhost">>},
|
[{server, <<"localhost">>},
|
||||||
{port, 5222},
|
{port, 5222},
|
||||||
{user, <<"test_suite">>},
|
{certfile, CertFile},
|
||||||
{password, <<"pass">>},
|
{password, <<"password">>}
|
||||||
{certfile, CertFile}
|
|
||||||
|Config].
|
|Config].
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_group(_GroupName, Config) ->
|
init_per_group(GroupName, Config) ->
|
||||||
Config.
|
User = list_to_binary(atom_to_list(GroupName)),
|
||||||
|
set_opt(user, User, Config).
|
||||||
|
|
||||||
end_per_group(_GroupName, _Config) ->
|
end_per_group(_GroupName, _Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(start_ejabberd, Config) ->
|
|
||||||
Config;
|
|
||||||
init_per_testcase(TestCase, OrigConfig) ->
|
init_per_testcase(TestCase, OrigConfig) ->
|
||||||
Resource = list_to_binary(atom_to_list(TestCase)),
|
Resource = list_to_binary(atom_to_list(TestCase)),
|
||||||
Config = set_opt(resource, Resource, OrigConfig),
|
Config = set_opt(resource, Resource, OrigConfig),
|
||||||
|
@ -83,6 +82,9 @@ init_per_testcase(TestCase, OrigConfig) ->
|
||||||
auth(connect(Config));
|
auth(connect(Config));
|
||||||
test_open_session ->
|
test_open_session ->
|
||||||
bind(auth(connect(Config)));
|
bind(auth(connect(Config)));
|
||||||
|
stop_ejabberd ->
|
||||||
|
Config1 = set_opt(user, <<"stop_ejabberd">>, Config),
|
||||||
|
open_session(bind(auth(register(connect(Config1)))));
|
||||||
_ ->
|
_ ->
|
||||||
open_session(bind(auth(connect(Config))))
|
open_session(bind(auth(connect(Config))))
|
||||||
end.
|
end.
|
||||||
|
@ -91,13 +93,8 @@ end_per_testcase(_TestCase, _Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
groups() ->
|
groups() ->
|
||||||
[].
|
[{single_user, [sequence],
|
||||||
|
[test_connect,
|
||||||
%%all() -> [start_ejabberd, test_zlib].
|
|
||||||
|
|
||||||
all() ->
|
|
||||||
[start_ejabberd,
|
|
||||||
test_connect,
|
|
||||||
test_starttls,
|
test_starttls,
|
||||||
test_zlib,
|
test_zlib,
|
||||||
test_register,
|
test_register,
|
||||||
|
@ -118,12 +115,10 @@ all() ->
|
||||||
privacy,
|
privacy,
|
||||||
blocking,
|
blocking,
|
||||||
vcard,
|
vcard,
|
||||||
pubsub,
|
pubsub]}].
|
||||||
stop_ejabberd].
|
|
||||||
|
|
||||||
start_ejabberd(Config) ->
|
all() ->
|
||||||
ok = application:start(ejabberd),
|
[{group, single_user}, stop_ejabberd].
|
||||||
Config.
|
|
||||||
|
|
||||||
stop_ejabberd(Config) ->
|
stop_ejabberd(Config) ->
|
||||||
ok = application:stop(ejabberd),
|
ok = application:stop(ejabberd),
|
||||||
|
@ -175,7 +170,7 @@ disconnect(Config) ->
|
||||||
test_starttls(Config) ->
|
test_starttls(Config) ->
|
||||||
case ?config(starttls, Config) of
|
case ?config(starttls, Config) of
|
||||||
true ->
|
true ->
|
||||||
starttls(Config);
|
disconnect(starttls(Config));
|
||||||
_ ->
|
_ ->
|
||||||
{skipped, 'starttls_not_available'}
|
{skipped, 'starttls_not_available'}
|
||||||
end.
|
end.
|
||||||
|
@ -187,14 +182,14 @@ starttls(Config) ->
|
||||||
?config(socket, Config),
|
?config(socket, Config),
|
||||||
[{certfile, ?config(certfile, Config)},
|
[{certfile, ?config(certfile, Config)},
|
||||||
connect]),
|
connect]),
|
||||||
disconnect(init_stream(set_opt(socket, TLSSocket, Config))).
|
init_stream(set_opt(socket, TLSSocket, Config)).
|
||||||
|
|
||||||
test_zlib(Config) ->
|
test_zlib(Config) ->
|
||||||
case ?config(compression, Config) of
|
case ?config(compression, Config) of
|
||||||
[_|_] = Ms ->
|
[_|_] = Ms ->
|
||||||
case lists:member(<<"zlib">>, Ms) of
|
case lists:member(<<"zlib">>, Ms) of
|
||||||
true ->
|
true ->
|
||||||
zlib(Config);
|
disconnect(zlib(Config));
|
||||||
false ->
|
false ->
|
||||||
{skipped, 'zlib_not_available'}
|
{skipped, 'zlib_not_available'}
|
||||||
end;
|
end;
|
||||||
|
@ -206,12 +201,12 @@ zlib(Config) ->
|
||||||
_ = send(Config, #compress{methods = [<<"zlib">>]}),
|
_ = send(Config, #compress{methods = [<<"zlib">>]}),
|
||||||
#compressed{} = recv(),
|
#compressed{} = recv(),
|
||||||
ZlibSocket = ejabberd_socket:compress(?config(socket, Config)),
|
ZlibSocket = ejabberd_socket:compress(?config(socket, Config)),
|
||||||
disconnect(init_stream(set_opt(socket, ZlibSocket, Config))).
|
init_stream(set_opt(socket, ZlibSocket, Config)).
|
||||||
|
|
||||||
test_register(Config) ->
|
test_register(Config) ->
|
||||||
case ?config(register, Config) of
|
case ?config(register, Config) of
|
||||||
true ->
|
true ->
|
||||||
register(Config);
|
disconnect(register(Config));
|
||||||
_ ->
|
_ ->
|
||||||
{skipped, 'registration_not_available'}
|
{skipped, 'registration_not_available'}
|
||||||
end.
|
end.
|
||||||
|
@ -231,7 +226,7 @@ register(Config) ->
|
||||||
%% TODO: fix in ejabberd
|
%% TODO: fix in ejabberd
|
||||||
%% #iq{type = result, id = I2, sub_els = []} = recv(),
|
%% #iq{type = result, id = I2, sub_els = []} = recv(),
|
||||||
#iq{type = result, id = I2, sub_els = [#register{}]} = recv(),
|
#iq{type = result, id = I2, sub_els = [#register{}]} = recv(),
|
||||||
disconnect(Config).
|
Config.
|
||||||
|
|
||||||
test_auth(Config) ->
|
test_auth(Config) ->
|
||||||
disconnect(auth(Config)).
|
disconnect(auth(Config)).
|
||||||
|
@ -587,7 +582,7 @@ re_register(Config) ->
|
||||||
recv() ->
|
recv() ->
|
||||||
receive
|
receive
|
||||||
{'$gen_event', {xmlstreamelement, El}} ->
|
{'$gen_event', {xmlstreamelement, El}} ->
|
||||||
ct:log("recv: ~p", [El]),
|
ct:pal("recv: ~p", [El]),
|
||||||
xmpp_codec:decode(fix_ns(El));
|
xmpp_codec:decode(fix_ns(El));
|
||||||
{'$gen_event', Event} ->
|
{'$gen_event', Event} ->
|
||||||
Event
|
Event
|
||||||
|
@ -624,7 +619,7 @@ send(State, Pkt) ->
|
||||||
{undefined, Pkt}
|
{undefined, Pkt}
|
||||||
end,
|
end,
|
||||||
El = xmpp_codec:encode(NewPkt),
|
El = xmpp_codec:encode(NewPkt),
|
||||||
ct:log("sent: ~p", [El]),
|
ct:pal("sent: ~p", [El]),
|
||||||
ok = send_text(State, xml:element_to_binary(El)),
|
ok = send_text(State, xml:element_to_binary(El)),
|
||||||
NewID.
|
NewID.
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
{access, muc, [{allow, all}]}.
|
{access, muc, [{allow, all}]}.
|
||||||
{access, pubsub_createnode, [{allow, local}]}.
|
{access, pubsub_createnode, [{allow, local}]}.
|
||||||
{access, register, [{allow, all}]}.
|
{access, register, [{allow, all}]}.
|
||||||
|
{registration_timeout, infinity}.
|
||||||
{language, "en"}.
|
{language, "en"}.
|
||||||
{modules,
|
{modules,
|
||||||
[
|
[
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue