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

parallelize sm_SUITE #740

Merged
merged 2 commits into from
Apr 18, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions test/ejabberd_tests/tests/mongoose_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
-export([auth_modules/0]).

-export([total_offline_messages/0,
total_offline_messages/1,
total_active_users/0,
total_privacy_items/0,
total_private_items/0,
Expand All @@ -27,6 +28,10 @@ auth_modules() ->
total_offline_messages() ->
generic_count(mod_offline_backend).

-spec total_offline_messages({binary(), binary()}) -> integer() | false.
total_offline_messages(User) ->
generic_count(mod_offline_backend, User).

-spec total_active_users() -> integer() | false.
total_active_users() ->
generic_count(mod_last_backend).
Expand Down Expand Up @@ -89,6 +94,10 @@ get_backend(Module) ->
Backend -> Backend
end.

generic_count(mod_offline_backend, {User, Server}) ->
?RPC(mod_offline_backend, count_offline_messages, [User, Server, 100]).


generic_count(Module) ->
case get_backend(Module) of
false -> %% module disabled
Expand Down Expand Up @@ -126,6 +135,7 @@ count_wildpattern(Table) ->
Pattern = ?RPC(mnesia, table_info, [Table, wild_pattern]),
length(?RPC(mnesia, dirty_match_object, [Pattern])).


count_odbc(Table) ->
{selected, _, [{N}]} =
?RPC(ejabberd_odbc,sql_query, [<<"localhost">>,[<<"select count(*) from ", Table/binary, " ;">>]]),
Expand Down
Loading