Skip to content

Commit

Permalink
Merge pull request #3123 from esl/mu-multitenancy-mam
Browse files Browse the repository at this point in the history
Multitenancy for MAM/MUC

This PR addresses "MAM/MUC test suites are passing for dynamic domains".

Proposed changes include:
    hook refactoring
    Common Tests Hooks for big tests fail, if init_per_suite fails. Added some more strictness there. Separate PR: #3133
    More granular rules in domain_isolation_SUITE, also converted it for HostTypes.
    We COULD pass hosttype as a separate arg to muclight DB backend (and we probably should), but it would increase complexity of the current PR, I would like to do it in a separate one.
    ejabberd_users refactoring would be a separate PR.
    REST API should be done in a separate PR.
    commands API should be done in a separate PR.

Moved into #3137:
    Add reason to some XMPP and HTTP errors.
    New module mongoose_record_pp to pretty print records in logs (it should be called manually though).
  • Loading branch information
NelsonVides authored May 31, 2021
2 parents 2238410 + 5b27443 commit 6433bca
Show file tree
Hide file tree
Showing 67 changed files with 2,744 additions and 2,315 deletions.
42 changes: 39 additions & 3 deletions big_tests/dynamic_domains.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@

{hosts, [{mim, [{node, mongooseim@localhost},
{domain, <<"domain.example.com">>},
{host_type, <<"test type">>},
{secondary_domain, <<"domain.example.org">>},
{secondary_host_type, <<"test type">>},
{dynamic_domains, [<<"domain.example.com">>, <<"domain.example.org">>]},
{host_type, <<"test type">>},
{muc_service, <<"groupchats.domain.example.com">>},
{muc_service_pattern, <<"groupchats.@HOST@">>},
{muc_light_service, <<"muclight2.domain.example.com">>},
{muc_light_service_pattern, <<"muclight2.@HOST@">>},
{vars, "mim1"},
{cluster, mim},
{s2s_port, 5269},
Expand All @@ -20,7 +25,15 @@
{kicking_service_port, 8666},
{hidden_service_port, 8189},
{gd_endpoint_port, 5555},
{http_notifications_port, 8000}]}
{http_notifications_port, 8000}]},
%% used to test s2s features
{fed, [{node, fed1@localhost},
{domain, <<"fed1">>},
{host_type, <<"fed1">>},
{vars, "fed1"},
{incoming_s2s_port, 5299},
{c2s_port, 5242},
{cluster, fed}]}
]}.

{escalus_users, [
Expand All @@ -39,6 +52,14 @@
{server, <<"domain.example.com">>},
{host, <<"localhost">>},
{password, <<"makrolika">>}]},
{carol, [
{username, <<"carol">>},
{server, <<"domain.example.com">>},
{host, <<"localhost">>},
{password, <<"jinglebells">>},
{transport, escalus_bosh},
{path, <<"/http-bind">>},
{port, 5280}]},
{kate, [
{username, <<"kate">>},
{server, <<"domain.example.com">>},
Expand All @@ -48,5 +69,20 @@
{username, <<"mike">>},
{server, <<"domain.example.com">>},
{host, <<"localhost">>},
{password, <<"nicniema">>}]}
{password, <<"nicniema">>}]},
{admin, [
{username, <<"admin">>},
{server, <<"localhost">>},
{password, <<"bruce_almighty">>}]},
{alice3, [ %% used in dynamic_domains_SUITE
{username, <<"alice">>},
{server, <<"example.com">>},
{host, <<"localhost">>},
{password, <<"makota2">>}]},
{bob3, [ %% used in dynamic_domains_SUITE
{username, <<"bob">>},
{server, <<"example.org">>},
{host, <<"localhost">>},
{password, <<"makota3">>},
{port, 5232}]}
]}.
53 changes: 53 additions & 0 deletions big_tests/dynamic_domains.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
{include, "tests"}.

{suites, "tests", acc_e2e_SUITE}.
{suites, "tests", domain_isolation_SUITE}.
{suites, "tests", muc_SUITE}.
{suites, "tests", muc_light_SUITE}.
{suites, "tests", muc_light_legacy_SUITE}.
{suites, "tests", mam_SUITE}.

{suites, "tests", carboncopy_SUITE}.
{skip_cases, "tests", carboncopy_SUITE, [discovering_support],
Expand All @@ -29,6 +34,54 @@
{skip_groups, "tests", inbox_extensions_SUITE, [muclight],
"at the moment muclight doesn't support dynamic domains"}.

{skip_cases, "tests", mam_SUITE,
[muc_service_discovery, mam_service_discovery],
"at the moment mod_disco doesn't support dynamic domains"}.
{skip_cases, "tests", mam_SUITE,
[messages_filtered_when_prefs_default_policy_is_roster],
"at the moment mod_roster doesn't support dynamic domains"}.
{skip_cases, "tests", mam_SUITE,
[metric_incremented_when_store_message,
metric_incremented_on_archive_request],
"this test is broken in PR #3120"}.

{skip_groups, "tests", muc_SUITE,
[disco, disco_non_parallel, disco_rsm, disco_rsm_with_offline],
"at the moment mod_disco doesn't support dynamic domains"}.
{skip_groups, "tests", muc_SUITE,
[register_over_s2s],
"at the moment S2S doesn't support dynamic domains "
"(requires mod_register creating CT users)"}.

{skip_cases, "tests", muc_light_SUITE,
[disco_service,
disco_features,
disco_features_with_mam,
disco_info,
disco_info_with_mam,
disco_rooms,
disco_rooms_rsm,
disco_rooms_created_page_1,
disco_rooms_created_page_infinity,
disco_rooms_empty_page_infinity,
disco_rooms_empty_page_1],
"at the moment mod_disco doesn't support dynamic domains"}.
{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"}.

{skip_cases, "tests", muc_light_legacy_SUITE,
[disco_service,
disco_features,
disco_features_with_mam,
disco_info,
disco_info_with_mam,
disco_rooms,
disco_rooms_rsm],
"at the moment mod_disco doesn't support dynamic domains"}.

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

{logdir, "ct_report"}.
Expand Down
10 changes: 10 additions & 0 deletions big_tests/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@
%% so that we rein the "bag of things" approach
{hosts, [{mim, [{node, mongooseim@localhost},
{domain, <<"localhost">>},
{host_type, <<"localhost">>},
{vars, "mim1"},
{cluster, mim},
{secondary_domain, <<"localhost.bis">>},
{reloaded_domain, <<"sogndal">>},
{secondary_host_type, <<"localhost.bis">>},
{muc_service, <<"muc.localhost">>},
{muc_service_pattern, <<"muc.@HOST@">>},
{muc_light_service, <<"muclight.localhost">>},
{muc_light_service_pattern, <<"muclight.@HOST@">>},
{s2s_port, 5269},
{incoming_s2s_port, 5269},
{metrics_rest_port, 5288},
Expand All @@ -37,6 +43,7 @@
{http_notifications_port, 8000}]},
{mim2, [{node, ejabberd2@localhost},
{domain, <<"localhost">>},
{host_type, <<"localhost">>},
{vars, "mim2"},
{cluster, mim},
{c2s_tls_port, 5233},
Expand All @@ -45,19 +52,22 @@
{service_port, 8899}]},
{mim3, [{node, mongooseim3@localhost},
{domain, <<"localhost">>},
{host_type, <<"localhost">>},
{vars, "mim3"},
{c2s_tls_port, 5263},
{cluster, mim}]},
%% used to test s2s features
{fed, [{node, fed1@localhost},
{domain, <<"fed1">>},
{host_type, <<"fed1">>},
{vars, "fed1"},
{incoming_s2s_port, 5299},
{c2s_port, 5242},
{cluster, fed}]},
%% used to test global distribution features
{reg, [{node, reg1@localhost},
{domain, <<"reg1">>},
{host_type, <<"red1">>},
{vars, "reg1"},
{service_port, 9990},
{c2s_port, 5252},
Expand Down
10 changes: 9 additions & 1 deletion big_tests/tests/ct_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,12 @@ all_repeat_modes() ->
repeat_until_any_fail].

sensible_maximum_repeats() ->
ct:get_config(sensible_maximum_repeats, 100).
case is_ct_started() of
true ->
ct:get_config(sensible_maximum_repeats, 100);
false -> %% In case it's called from test-runner-complete script
100
end.

is_ct_started() ->
lists:keymember(common_test, 1, application:which_applications()).
19 changes: 12 additions & 7 deletions big_tests/tests/domain_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@
insert_domain/3,
delete_domain/2,
make_metrics_prefix/1,
host_type/0,
host_type/1,
host_type/2]).
secondary_host_type/0,
secondary_host_type/1]).

-import(distributed_helper, [get_or_fail/1, rpc/4, mim/0]).

host_type() ->
host_type(mim).

host_type(NodeKey) ->
host_type(NodeKey, domain).
get_or_fail({hosts, NodeKey, host_type}).

secondary_host_type() ->
secondary_host_type(mim).

host_type(NodeKey, DomainKey) ->
Node = #{node => get_or_fail({hosts, NodeKey, node})},
Domain = get_or_fail({hosts, NodeKey, DomainKey}),
{ok, HostType} = rpc(Node, mongoose_domain_core, get_host_type, [Domain]),
HostType.
secondary_host_type(NodeKey) ->
get_or_fail({hosts, NodeKey, secondary_host_type}).

make_metrics_prefix(HostType) ->
rpc(mim(), mongoose_metrics, make_host_type_name, [HostType]).
Expand Down
Loading

0 comments on commit 6433bca

Please sign in to comment.