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

C2s/merge master #3904

Merged
merged 50 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
bd0c840
Improve error handling in session
Dec 1, 2022
79e52ce
Rework mod_muc_light_api
chrzaszcz Dec 1, 2022
f5f8658
Update the REST API for MUC Light
chrzaszcz Dec 1, 2022
7e76911
Update the GraphQL API for MUC Light
chrzaszcz Dec 1, 2022
be08787
Update the GraphQL schema for MUC Light
chrzaszcz Dec 1, 2022
039adca
Fix wrong MUC domain name
chrzaszcz Dec 1, 2022
4de7380
Update tests for the GraphQL MUC Light API
chrzaszcz Dec 1, 2022
9788b67
Update REST API tests for MUC Light
chrzaszcz Dec 1, 2022
358ab98
Add configuration flag for inbox delete domain operations
NelsonVides Dec 2, 2022
546a6f0
Relax required type for mod_mam_utils:batch_delete_limits
NelsonVides Dec 2, 2022
3a222ff
Relax some ignored return types for inbox remove_domain
NelsonVides Dec 2, 2022
514b947
Test that incrementally removing inbox works
NelsonVides Dec 2, 2022
8e484f9
Implement incremental inbox domain removal
NelsonVides Dec 2, 2022
0d0c822
Merge pull request #3889 from esl/remove_domain/incremental_db_deletes
chrzaszcz Dec 2, 2022
389cb78
Refactored hook handlers in ejabberd_ctl
pawlooss1 Dec 1, 2022
5e66fe0
Apply review comments
Dec 5, 2022
4deb53f
Update src/mod_roster.erl
pawlooss1 Dec 5, 2022
557e265
Merge pull request #3881 from esl/graphql-error-handling-muc-light
JanuszJakubiec Dec 6, 2022
f6346b2
Improve error handling in vcard
Dec 6, 2022
36a6d50
Improve error handling in metric API
jacekwegr Nov 16, 2022
aa0ac8e
Merge pull request #3861 from esl/improve-error-handling-in-metric-api
arcusfelis Dec 6, 2022
398d39a
Merge pull request #3883 from esl/api-modules/session
chrzaszcz Dec 6, 2022
64edde9
Merge pull request #3887 from esl/hooks/ejabberd_ctl
pawlooss1 Dec 7, 2022
69a7261
Apply review comments
Dec 7, 2022
31431f0
Revert history order
arcusfelis Dec 7, 2022
ab332a4
Simplify the GraphQL handler name
chrzaszcz Dec 7, 2022
2567190
Merge pull request #3890 from esl/api-modules/vcard
chrzaszcz Dec 8, 2022
0239653
Update npm to work with the latest SpectaQL
chrzaszcz Dec 8, 2022
2afb39b
Replace 'egrep' with 'grep -E'
chrzaszcz Dec 8, 2022
5e2708c
Merge pull request #3894 from esl/rename-graphql-handler
Premwoik Dec 8, 2022
146cab3
Merge pull request #3898 from esl/update-npm-for-docs
arcusfelis Dec 8, 2022
d9a5c46
Merge pull request #3897 from esl/egrep-is-obsolescent
Premwoik Dec 9, 2022
83e5fe3
Fixing errors in mod_private
Dec 7, 2022
9e6a046
Fixing user format in error
Dec 7, 2022
1f5a5f1
Fixing CR issues
Dec 8, 2022
25d7042
Removed ejabberd_hooks module
pawlooss1 Dec 7, 2022
2aa6c91
Merge pull request #3892 from esl/remove_ejabberd_hooks
chrzaszcz Dec 12, 2022
093154b
Merge pull request #3893 from esl/mu-reverse-history-order
chrzaszcz Dec 12, 2022
481522d
Update revokeToken command
arcusfelis Dec 12, 2022
afdc1f6
Add importUsers to GraphQL
Dec 8, 2022
3f4438a
Fix unit tests
Dec 13, 2022
ffcc24b
Fixing CR issues
Dec 13, 2022
fbd64b6
Merge pull request #3891 from esl/api-modules/private
chrzaszcz Dec 14, 2022
94738b1
Fix tests
Dec 13, 2022
bc77610
Merge pull request #3895 from esl/graphql/import-users
chrzaszcz Dec 14, 2022
92e0dd9
Fix typo in doc/History.md
chrzaszcz Dec 15, 2022
773616a
Merge pull request #3900 from esl/mu-update-graphql-docs
jacekwegr Dec 15, 2022
b1a0e8a
Merge branch 'master' into c2s/merge_master
NelsonVides Dec 15, 2022
8a48d0a
Resolve conflicts
NelsonVides Dec 15, 2022
d0ead02
Remove ejabberd_hooks
NelsonVides Dec 15, 2022
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
2 changes: 1 addition & 1 deletion .circleci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ jobs:
docs_build_deploy:
parallelism: 1
docker:
- image: cimg/python:3.9.0-node
- image: cimg/python:3.11.0-node
steps:
- checkout
- run:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* [Developer's guide](https://esl.github.io/MongooseDocs/latest/developers-guide/Testing-MongooseIM/)
* [Packages](https://www.erlang-solutions.com/resources/download.html)
* Product page: [https://www.erlang-solutions.com/products/mongooseim.html](https://www.erlang-solutions.com/products/mongooseim.html)
* Documentation: [https://esl.github.io/MongooseDocs/](https://esl.github.io/MongooseDocs/)
* Documentation: [https://esl.github.io/MongooseDocs/](https://esl.github.io/MongooseDocs/latest/)

## Get to know MongooseIM
MongooseIM is a robust, scalable and efficient XMPP server at the core of an Instant Messaging platform aimed at large installations.
Expand Down
4 changes: 4 additions & 0 deletions big_tests/tests/domain_removal_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ all() ->
{group, mam_removal},
{group, mam_removal_incremental},
{group, inbox_removal},
{group, inbox_removal_incremental},
{group, muc_light_removal},
{group, muc_removal},
{group, private_removal},
Expand All @@ -39,6 +40,7 @@ groups() ->
{mam_removal_incremental, [], [mam_pm_removal,
mam_muc_removal]},
{inbox_removal, [], [inbox_removal]},
{inbox_removal_incremental, [], [inbox_removal]},
{muc_light_removal, [], [muc_light_removal,
muc_light_blocking_removal]},
{muc_removal, [], [muc_removal]},
Expand Down Expand Up @@ -108,6 +110,8 @@ group_to_modules(muc_removal) ->
[{mod_muc, muc_helper:make_opts(Opts)}];
group_to_modules(inbox_removal) ->
[{mod_inbox, inbox_helper:inbox_opts()}];
group_to_modules(inbox_removal_incremental) ->
[{mod_inbox, (inbox_helper:inbox_opts())#{delete_domain_limit => 1}}];
group_to_modules(private_removal) ->
[{mod_private, #{iqdisc => one_queue, backend => rdbms}}];
group_to_modules(roster_removal) ->
Expand Down
71 changes: 69 additions & 2 deletions big_tests/tests/graphql_account_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-module(graphql_account_SUITE).

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

-compile([export_all, nowarn_export_all]).

Expand All @@ -26,8 +27,8 @@ all() ->

groups() ->
[{user_account, [parallel], user_account_tests()},
{admin_account_http, [], admin_account_tests()},
{admin_account_cli, [], admin_account_tests()},
{admin_account_http, [], admin_account_tests() ++ admin_account_http_tests()},
{admin_account_cli, [], admin_account_tests() ++ admin_account_cli_tests()},
{domain_admin_account, [], domain_admin_tests()}].

user_account_tests() ->
Expand Down Expand Up @@ -55,6 +56,12 @@ admin_account_tests() ->
admin_change_user_password,
admin_change_non_existing_user_password].

admin_account_http_tests() ->
[admin_import_users_http].

admin_account_cli_tests() ->
[admin_import_users_cli].

domain_admin_tests() ->
[admin_list_users,
domain_admin_list_users_no_permission,
Expand Down Expand Up @@ -168,6 +175,11 @@ end_per_testcase(domain_admin_register_user = C, Config) ->
{Username, Domain} = proplists:get_value(user, Config),
rpc(mim(), mongoose_account_api, unregister_user, [Username, Domain]),
escalus:end_per_testcase(C, Config);
end_per_testcase(CaseName, Config)
when CaseName == admin_import_users_http; CaseName == admin_import_users_cli ->
Domain = domain_helper:domain(),
rpc(mim(), mongoose_account_api, unregister_user, [<<"john">>, Domain]),
escalus:end_per_testcase(CaseName, Config);
end_per_testcase(CaseName, Config) ->
escalus:end_per_testcase(CaseName, Config).

Expand Down Expand Up @@ -401,6 +413,57 @@ admin_change_non_existing_user_password(Config) ->
Resp3 = ban_user(?EMPTY_NAME_JID, NewPassword, Config),
get_coercion_err_msg(Resp3).

admin_import_users_cli(Config) ->
escalus:fresh_story(Config, [{alice, 1}], fun(_Alice) ->
% Non-existing file
Resp = import_users(<<"nonexisting.csv">>, Config),
?assertEqual(<<"File not found">>, get_err_msg(Resp)),
% Summary
Path = filename:join(?config(mim_data_dir, Config), "users.csv"),
Path2 = replace_hosts_in_file(Path),
Resp2 = import_users(list_to_binary(Path2), Config),
Domain = domain_helper:domain(),
?assertEqual(#{<<"status">> => <<"Completed">>,
<<"created">> => [<<"john@", Domain/binary>>],
<<"emptyPassword">> => [<<"elise@", Domain/binary>>],
<<"existing">> => [<<"alice@", Domain/binary>>],
<<"invalidJID">> => [<<",", Domain/binary, ",password">>],
<<"invalidRecord">> => [<<"elise,elise,", Domain/binary, ",esile">>],
<<"notAllowed">> => null},
get_ok_value([data, account, importUsers], Resp2))
end).

admin_import_users_http(Config) ->
escalus:fresh_story(Config, [{alice, 1}], fun(_Alice) ->
% Summary
Path = filename:join(?config(mim_data_dir, Config), "users.csv"),
Path2 = replace_hosts_in_file(Path),
Resp2 = import_users(list_to_binary(Path2), Config),
?assertEqual(#{<<"status">> => <<"ImportUsers scheduled">>,
<<"created">> => null,
<<"emptyPassword">> => null,
<<"existing">> => null,
<<"invalidJID">> => null,
<<"invalidRecord">> => null,
<<"notAllowed">> => null},
get_ok_value([data, account, importUsers], Resp2)),
Domain = domain_helper:domain(),
mongoose_helper:wait_until(fun() ->
rpc(mim(), mongoose_account_api, check_account, [<<"john">>, Domain])
end,
{ok, io_lib:format("User ~s exists", [<<"john@", Domain/binary>>])},
#{time_left => timer:seconds(20),
sleep_time => 1000,
name => verify_account_created})
end).

replace_hosts_in_file(Path) ->
{ok, Content} = file:read_file(Path),
Content2 = binary:replace(Content, <<"$host$">>, domain_helper:domain(), [global]),
Path2 = Path ++ ".tmp",
ok = file:write_file(Path2, Content2),
Path2.

domain_admin_list_users_no_permission(Config) ->
% An unknown domain
Resp1 = list_users(<<"unknown-domain">>, Config),
Expand Down Expand Up @@ -551,3 +614,7 @@ ban_user(JID, Reason, Config) ->
change_user_password(JID, NewPassword, Config) ->
Vars = #{<<"user">> => JID, <<"newPassword">> => NewPassword},
execute_command(<<"account">>, <<"changeUserPassword">>, Vars, Config).

import_users(Filename, Config) ->
Vars = #{<<"filename">> => Filename},
execute_command(<<"account">>, <<"importUsers">>, Vars, Config).
5 changes: 5 additions & 0 deletions big_tests/tests/graphql_account_SUITE_data/users.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
john,$host$,smith
alice,$host$,smith
elise,$host$,
,$host$,password
elise,elise,$host$,esile
2 changes: 1 addition & 1 deletion big_tests/tests/graphql_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ get_value([Field | Fields], Data) ->
get_value(Fields, Data2).

is_graphql_config(#{module := ejabberd_cowboy, handlers := Handlers}, ExpEpName) ->
lists:any(fun(#{module := mongoose_graphql_cowboy_handler, schema_endpoint := EpName}) ->
lists:any(fun(#{module := mongoose_graphql_handler, schema_endpoint := EpName}) ->
ExpEpName =:= EpName;
(_) -> false
end, Handlers);
Expand Down
Loading