Skip to content

Commit

Permalink
Merge pull request #3159 from esl/mod_roster_with_dynamic_domains
Browse files Browse the repository at this point in the history
Support dynamic domains in mod_roster

Main changes:

    * Update roster-related hooks and their handlers to use host types.
    * Update callbacks in mod_roster to use host types.
    * Update all roster backends to implement the new callbacks and support multiple domains and host types.
    * Enable roster-related tests with dynamic domains.

Side changes:

    * Remove deprecated functions from mod_roster. They started becoming tedious to maintain.
    * Change the templating of mod_roster to make the test type section consistent with the top-level ones by excluding the header from the template. This makes the templating itself a bit inconsistent, but IMO other modules can be converted as well. It makes sense to exclude constant parts from the template.
    * Change handling of unexpected roster IQs directed to other JIDs - return errors.
    * Make IQ handlers always respond with error 500 when they throw exceptions.
    * Fix a bug in ejabberd_local (it caused errors for empty feature lists).
    * Fix a bug in inbox tests (not enough cleanup, it was breaking subsequent tests).
    * Fix and enable shared roster tests, they were always skipped.

Not changed:

    * The roster_groups hook is only used by mod_pubsub and has no handlers. It can be removed, but we should figure out whether it needs a fix, as the resulting config field is always an empty list.
    * Migration guide - needs to be addressed later.

Take a quick look at the commit messages for more information.
  • Loading branch information
DenysGonchar committed Jun 29, 2021
2 parents 3789a21 + 9ef55c6 commit 20480a5
Show file tree
Hide file tree
Showing 28 changed files with 926 additions and 976 deletions.
42 changes: 18 additions & 24 deletions big_tests/dynamic_domains.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@

{suites, "tests", disco_and_caps_SUITE}.
{skip_cases, "tests", disco_and_caps_SUITE,
[user_can_query_friend_resources,
user_can_query_friend_features,
user_cannot_query_friend_resources_with_unknown_node],
"at the moment mod_roster doesn't support dynamic domains"}.
[user_can_query_friend_features],
"at the moment neither mod_offline nor mod_adhoc supports dynamic domains"
" and this test requires at least one of them to be enabled"
" to have a non-empty feature list"}.

{suites, "tests", domain_isolation_SUITE}.

{suites, "tests", inbox_SUITE}.
{skip_cases, "tests", inbox_SUITE, [msg_sent_to_offline_user],
Expand All @@ -27,9 +29,6 @@
{suites, "tests", inbox_extensions_SUITE}.

{suites, "tests", mam_SUITE}.
{skip_cases, "tests", mam_SUITE,
[messages_filtered_when_prefs_default_policy_is_roster],
"at the moment mod_roster doesn't support dynamic domains"}.

{suites, "tests", mod_ping_SUITE}.

Expand All @@ -41,23 +40,25 @@

{suites, "tests", muc_light_SUITE}.
{skip_cases, "tests", muc_light_SUITE,
[rooms_in_rosters,
rooms_in_rosters_doesnt_break_disco_info,
no_roomname_in_schema_doesnt_break_disco_and_roster],
"at the moment mod_roster doesn't support dynamic domains"}.
[rooms_in_rosters_doesnt_break_disco_info],
"at the moment neither mod_offline nor mod_adhoc supports dynamic domains"
" and this test requires at least one of them to be enabled"
" to have a non-empty feature list"}.

{suites, "tests", muc_light_legacy_SUITE}.

{suites, "tests", offline_stub_SUITE}.

{suites, "tests", domain_isolation_SUITE}.
{suites, "tests", presence_SUITE}.

{suites, "tests", race_conditions_SUITE}.

{suites, "tests", rest_client_SUITE}.
{skip_cases, "tests", rest_client_SUITE,
[non_default_http_server_name_is_returned_if_configured],
"at the moment mim2 node is not configured for dynamic domains"}.

{suites, "tests", sm_SUITE}.
{skip_cases, "tests", sm_SUITE,
[basic_ack,
h_ok_after_session_enabled_after_session,
subscription_requests_are_buffered_properly],
"at the moment mod_roster doesn't support dynamic domains"}.
{skip_cases, "tests", sm_SUITE,
[resend_unacked_on_reconnection,
session_established,
Expand All @@ -69,13 +70,6 @@
unacknowledged_message_hook_offline],
"at the moment mod_offline doesn't support dynamic domains"}.

{suites, "tests", rest_client_SUITE}.
{skip_groups, "tests", rest_client_SUITE, [roster],
"at the moment mod_roster doesn't support dynamic domains"}.
{skip_cases, "tests", rest_client_SUITE,
[non_default_http_server_name_is_returned_if_configured],
"at the moment mim2 node is not configured for dynamic domains"}.

{config, ["dynamic_domains.config", "test.config"]}.

{logdir, "ct_report"}.
Expand Down
8 changes: 4 additions & 4 deletions big_tests/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
{mod_vcard, "[modules.mod_vcard]
backend = \"rdbms\"
host = \"vjud.@HOST@\""},
{mod_roster, "[modules.mod_roster]
{mod_roster, "
backend = \"rdbms\""}]},
{odbc_mssql_mnesia,
[{dbs, [redis, mssql]},
Expand All @@ -287,7 +287,7 @@
{mod_vcard, "[modules.mod_vcard]
backend = \"rdbms\"
host = \"vjud.@HOST@\""},
{mod_roster, "[modules.mod_roster]
{mod_roster, "
backend = \"rdbms\""}]},
{mysql_redis,
[{dbs, [redis, mysql, rmq]},
Expand Down Expand Up @@ -322,7 +322,7 @@
{mod_vcard, "[modules.mod_vcard]
backend = \"rdbms\"
host = \"vjud.@HOST@\""},
{mod_roster, "[modules.mod_roster]
{mod_roster, "
backend = \"rdbms\""}]},
{ldap_mnesia,
[{dbs, [redis, ldap]},
Expand Down Expand Up @@ -394,7 +394,7 @@
{mod_vcard, "[modules.mod_vcard]
backend = \"riak\"
host = \"vjud.@HOST@\""},
{mod_roster, "[modules.mod_roster]
{mod_roster, "
backend = \"riak\""}
]},
{elasticsearch_and_cassandra_mnesia,
Expand Down
3 changes: 3 additions & 0 deletions big_tests/tests/inbox_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ init_per_group(muc, Config) ->
init_per_group(_GroupName, Config) ->
Config.

end_per_group(muc, Config) ->
HostType = domain_helper:host_type(mim),
dynamic_modules:stop(HostType, mod_muc);
end_per_group(muclight, Config) ->
muc_light_helper:clear_db(),
HostType = domain_helper:host_type(mim),
Expand Down
3 changes: 2 additions & 1 deletion big_tests/tests/ldap_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ create_user({_User, Spec}) ->

delete_user({_Name, Spec}) ->
{User, Server, _Password} = get_usp(Spec),
rpc(mim(), ejabberd_auth_ldap, remove_user, [User, Server]).
HostType = domain_helper:host_type(),
rpc(mim(), ejabberd_auth_ldap, remove_user, [HostType, User, Server]).

get_usp(Spec) ->
Username = proplists:get_value(username, Spec),
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/muc_light_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ rooms_in_rosters(Config) ->
distributed_helper:mim(),
mod_roster,
get_user_rosters_length,
[jid:make(AliceU, AliceS, <<>>)])
[host_type(), jid:make(AliceU, AliceS, <<>>)])
end, 1, #{time_left => timer:seconds(10)}),
RosterResult = escalus:wait_for_stanza(Alice),
escalus_assert:is_roster_result(RosterResult),
Expand Down
Loading

0 comments on commit 20480a5

Please sign in to comment.