From 2cb8d1099da0b7c534e8dad3c7178ca73187e61b Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Fri, 6 Oct 2023 17:59:48 +0200 Subject: [PATCH 01/16] Run bosh_SUITE with CETS now --- big_tests/test.config | 1 + big_tests/tests/bosh_SUITE.erl | 23 ++++++++++++----------- big_tests/tests/mongoose_helper.erl | 4 ++++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/big_tests/test.config b/big_tests/test.config index 42b798fc706..f3de0b461a9 100644 --- a/big_tests/test.config +++ b/big_tests/test.config @@ -241,6 +241,7 @@ workers = 10"}]}, {pgsql_cets, [{dbs, [redis, pgsql]}, + {mnesia_or_cets_backend, cets}, {sm_backend, "\"cets\""}, {bosh_backend, "\"cets\""}, {component_backend, "\"cets\""}, diff --git a/big_tests/tests/bosh_SUITE.erl b/big_tests/tests/bosh_SUITE.erl index 67d78c32a49..5313d2983b1 100644 --- a/big_tests/tests/bosh_SUITE.erl +++ b/big_tests/tests/bosh_SUITE.erl @@ -116,21 +116,21 @@ end_per_suite(Config) -> escalus:end_per_suite(Config). init_per_group(time, Config) -> - dynamic_modules:ensure_modules(host_type(), required_modules(time)), + dynamic_modules:ensure_modules(host_type(), required_modules(time, Config)), Config; init_per_group(GroupName, Config) when GroupName =:= essential; GroupName =:= without_bosh -> - dynamic_modules:ensure_modules(host_type(), required_modules(GroupName)), + dynamic_modules:ensure_modules(host_type(), required_modules(GroupName, Config)), [{user, carol} | Config]; init_per_group(essential_https, Config) -> - dynamic_modules:ensure_modules(host_type(), required_modules(essential_https)), + dynamic_modules:ensure_modules(host_type(), required_modules(essential_https, Config)), [{user, carol_s} | Config]; init_per_group(chat_https, Config) -> - dynamic_modules:ensure_modules(host_type(), required_modules(chat_https)), + dynamic_modules:ensure_modules(host_type(), required_modules(chat_https, Config)), Config1 = escalus:create_users(Config, escalus:get_users([carol, carol_s, geralt, alice])), [{user, carol_s} | Config1]; init_per_group(GroupName, Config) -> - dynamic_modules:ensure_modules(host_type(), required_modules(GroupName)), + dynamic_modules:ensure_modules(host_type(), required_modules(GroupName, Config)), Config1 = escalus:create_users(Config, escalus:get_users([carol, carol_s, geralt, alice])), [{user, carol} | Config1]. @@ -151,11 +151,12 @@ end_per_testcase(CaseName, Config) -> %% Module configuration per group -required_modules(without_bosh) -> +required_modules(without_bosh, _Config) -> [{mod_bosh, stopped}]; -required_modules(GroupName) -> - [{mod_bosh, maps:merge(config_parser_helper:default_mod_config(mod_bosh), - required_bosh_opts(GroupName))}]. +required_modules(GroupName, Config) -> + Backend = mongoose_helper:mnesia_or_cets_backend(Config), + ModOpts = config_parser_helper:mod_config(mod_bosh, #{backend => Backend}), + [{mod_bosh, maps:merge(ModOpts, required_bosh_opts(GroupName))}]. required_bosh_opts(time) -> #{max_wait => ?MAX_WAIT, inactivity => ?INACTIVITY}; @@ -941,7 +942,7 @@ wait_until_user_has_no_stanzas(User) -> wait_for_zero_bosh_sessions() -> mongoose_helper:wait_until(fun() -> - length(get_bosh_sessions()) + get_bosh_sessions() end, - 0, + [], #{name => get_bosh_sessions}). diff --git a/big_tests/tests/mongoose_helper.erl b/big_tests/tests/mongoose_helper.erl index 93aa4248d2c..53475665f7b 100644 --- a/big_tests/tests/mongoose_helper.erl +++ b/big_tests/tests/mongoose_helper.erl @@ -9,6 +9,7 @@ get_backend_mnesia_rdbms/1, backend_for_module/2, mnesia_or_rdbms_backend/0, + mnesia_or_cets_backend/1, get_backend_name/2]). -export([auth_modules/0]). @@ -70,6 +71,9 @@ mnesia_or_rdbms_backend() -> false -> mnesia end. +mnesia_or_cets_backend(Config) -> + ct_helper:get_preset_var(Config, mnesia_or_cets_backend, mnesia). + get_backend_mnesia_rdbms(HostType) -> case is_rdbms_enabled(HostType) of false -> mnesia; From 44d6d01d51f8011000b948673025e954b9d472e7 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Fri, 6 Oct 2023 18:12:11 +0200 Subject: [PATCH 02/16] Run mod_muc/mod_muc_light with a correct backend in gdpr_SUITE --- big_tests/tests/gdpr_SUITE.erl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/big_tests/tests/gdpr_SUITE.erl b/big_tests/tests/gdpr_SUITE.erl index 9174ed44eec..e4242a3bf64 100644 --- a/big_tests/tests/gdpr_SUITE.erl +++ b/big_tests/tests/gdpr_SUITE.erl @@ -350,30 +350,34 @@ mam_required_modules(CN, Backend) when CN =:= remove_mam_pm; mam_required_modules(CN, Backend) when CN =:= retrieve_mam_pm_and_muc_light_dont_interfere; CN =:= retrieve_mam_muc_light -> HostPattern = subhost_pattern(muc_light_helper:muc_host_pattern()), + MucLightOpts = #{backend => mongoose_helper:mnesia_or_rdbms_backend()}, [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{}, muc => #{host => HostPattern}})}, - {mod_muc_light, default_mod_config(mod_muc_light)}]; + {mod_muc_light, mod_config(mod_muc_light, MucLightOpts)}]; mam_required_modules(retrieve_mam_pm_and_muc_light_interfere, Backend) -> HostPattern = subhost_pattern(muc_light_helper:muc_host_pattern()), + MucLightOpts = #{backend => mongoose_helper:mnesia_or_rdbms_backend()}, [{mod_mam, mam_helper:config_opts(#{backend => Backend, db_message_format => mam_message_xml, pm => #{archive_groupchats => true}, muc => #{host => HostPattern}})}, - {mod_muc_light, default_mod_config(mod_muc_light)}]; + {mod_muc_light, mod_config(mod_muc_light, MucLightOpts)}]; mam_required_modules(CN, Backend) when CN =:= retrieve_mam_muc_private_msg; CN =:= retrieve_mam_muc -> HostPattern = subhost_pattern(muc_helper:muc_host_pattern()), [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{}, muc => #{host => HostPattern}})}, - {mod_muc, muc_helper:make_opts(#{host => HostPattern})}]; + {mod_muc, muc_helper:make_opts(#{host => HostPattern, + backend => mongoose_helper:mnesia_or_rdbms_backend()})}]; mam_required_modules(retrieve_mam_muc_store_pm, Backend) -> HostPattern = subhost_pattern(muc_helper:muc_host_pattern()), [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{archive_groupchats => true}, muc => #{host => HostPattern}})}, - {mod_muc, muc_helper:make_opts(#{host => HostPattern})}]. + {mod_muc, muc_helper:make_opts(#{host => HostPattern, + backend => mongoose_helper:mnesia_or_rdbms_backend()})}]. pick_enabled_backend() -> BackendsList = [ From 088d648d71dde187cc3e879ec110d1914eecca07 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Fri, 6 Oct 2023 18:43:08 +0200 Subject: [PATCH 03/16] Start modules with correct backends in gdpr_SUITE --- big_tests/tests/gdpr_SUITE.erl | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/big_tests/tests/gdpr_SUITE.erl b/big_tests/tests/gdpr_SUITE.erl index e4242a3bf64..9b9a8735c29 100644 --- a/big_tests/tests/gdpr_SUITE.erl +++ b/big_tests/tests/gdpr_SUITE.erl @@ -281,7 +281,7 @@ init_per_testcase(CN, Config) when CN =:= retrieve_mam_muc; {skip, no_mam_backend_configured}; Backend -> dynamic_modules:restore_modules(Config), - RequiredModules = mam_required_modules(CN, Backend), + RequiredModules = mam_required_modules(CN, Backend, Config), dynamic_modules:ensure_modules(host_type(), RequiredModules), ct:log("required modules: ~p~n", [RequiredModules]), escalus:init_per_testcase(CN, [{mam_modules, RequiredModules} | Config]) @@ -344,18 +344,20 @@ groupchat_module(muclight) -> #{backend => mongoose_helper:mnesia_or_rdbms_backend(), rooms_in_rosters => true})}]. -mam_required_modules(CN, Backend) when CN =:= remove_mam_pm; - CN =:= retrieve_mam_pm -> +mam_required_modules(CN, Backend, _Config) + when CN =:= remove_mam_pm; + CN =:= retrieve_mam_pm -> [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{}})}]; -mam_required_modules(CN, Backend) when CN =:= retrieve_mam_pm_and_muc_light_dont_interfere; - CN =:= retrieve_mam_muc_light -> +mam_required_modules(CN, Backend, _Config) + when CN =:= retrieve_mam_pm_and_muc_light_dont_interfere; + CN =:= retrieve_mam_muc_light -> HostPattern = subhost_pattern(muc_light_helper:muc_host_pattern()), MucLightOpts = #{backend => mongoose_helper:mnesia_or_rdbms_backend()}, [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{}, muc => #{host => HostPattern}})}, {mod_muc_light, mod_config(mod_muc_light, MucLightOpts)}]; -mam_required_modules(retrieve_mam_pm_and_muc_light_interfere, Backend) -> +mam_required_modules(retrieve_mam_pm_and_muc_light_interfere, Backend, _Config) -> HostPattern = subhost_pattern(muc_light_helper:muc_host_pattern()), MucLightOpts = #{backend => mongoose_helper:mnesia_or_rdbms_backend()}, [{mod_mam, mam_helper:config_opts(#{backend => Backend, @@ -363,21 +365,25 @@ mam_required_modules(retrieve_mam_pm_and_muc_light_interfere, Backend) -> pm => #{archive_groupchats => true}, muc => #{host => HostPattern}})}, {mod_muc_light, mod_config(mod_muc_light, MucLightOpts)}]; -mam_required_modules(CN, Backend) when CN =:= retrieve_mam_muc_private_msg; - CN =:= retrieve_mam_muc -> +mam_required_modules(CN, Backend, Config) when CN =:= retrieve_mam_muc_private_msg; + CN =:= retrieve_mam_muc -> HostPattern = subhost_pattern(muc_helper:muc_host_pattern()), + MucOpts = #{host => HostPattern, + online_backend => mongoose_helper:mnesia_or_cets_backend(Config), + backend => mongoose_helper:mnesia_or_rdbms_backend()}, [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{}, muc => #{host => HostPattern}})}, - {mod_muc, muc_helper:make_opts(#{host => HostPattern, - backend => mongoose_helper:mnesia_or_rdbms_backend()})}]; -mam_required_modules(retrieve_mam_muc_store_pm, Backend) -> + {mod_muc, muc_helper:make_opts(MucOpts)}]; +mam_required_modules(retrieve_mam_muc_store_pm, Backend, Config) -> HostPattern = subhost_pattern(muc_helper:muc_host_pattern()), + MucOpts = #{host => HostPattern, + online_backend => mongoose_helper:mnesia_or_cets_backend(Config), + backend => mongoose_helper:mnesia_or_rdbms_backend()}, [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{archive_groupchats => true}, muc => #{host => HostPattern}})}, - {mod_muc, muc_helper:make_opts(#{host => HostPattern, - backend => mongoose_helper:mnesia_or_rdbms_backend()})}]. + {mod_muc, muc_helper:make_opts(MucOpts)}]. pick_enabled_backend() -> BackendsList = [ From ace975f69a3a7cf4f150721eb2d87ee0cb662747 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Fri, 6 Oct 2023 18:52:51 +0200 Subject: [PATCH 04/16] Start modules with correct backends in sasl2/bind2 suites --- big_tests/tests/bind2_SUITE.erl | 2 +- big_tests/tests/sasl2_SUITE.erl | 2 +- big_tests/tests/sasl2_helper.erl | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/big_tests/tests/bind2_SUITE.erl b/big_tests/tests/bind2_SUITE.erl index 73d5170a887..397b02d2c52 100644 --- a/big_tests/tests/bind2_SUITE.erl +++ b/big_tests/tests/bind2_SUITE.erl @@ -68,7 +68,7 @@ end_per_testcase(Name, Config) -> load_modules(Config) -> HostType = domain_helper:host_type(), Config1 = dynamic_modules:save_modules(HostType, Config), - sasl2_helper:load_all_sasl2_modules(HostType), + sasl2_helper:load_all_sasl2_modules(HostType, Config1), Config1. %%-------------------------------------------------------------------- diff --git a/big_tests/tests/sasl2_SUITE.erl b/big_tests/tests/sasl2_SUITE.erl index 3866ef13809..cadd58b84df 100644 --- a/big_tests/tests/sasl2_SUITE.erl +++ b/big_tests/tests/sasl2_SUITE.erl @@ -88,7 +88,7 @@ end_per_testcase(Name, Config) -> load_sasl_extensible(Config) -> HostType = domain_helper:host_type(), Config1 = dynamic_modules:save_modules(HostType, Config), - sasl2_helper:load_all_sasl2_modules(HostType), + sasl2_helper:load_all_sasl2_modules(HostType, Config1), Config1. %%-------------------------------------------------------------------- diff --git a/big_tests/tests/sasl2_helper.erl b/big_tests/tests/sasl2_helper.erl index f4a419e9531..b1b1d9f4e4e 100644 --- a/big_tests/tests/sasl2_helper.erl +++ b/big_tests/tests/sasl2_helper.erl @@ -13,12 +13,13 @@ ns() -> ?NS_SASL_2. -load_all_sasl2_modules(HostType) -> +load_all_sasl2_modules(HostType, Config) -> + MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), Modules = [{mod_bind2, config_parser_helper:default_mod_config(mod_bind2)}, {mod_sasl2, config_parser_helper:default_mod_config(mod_sasl2)}, {mod_csi, config_parser_helper:default_mod_config(mod_csi)}, {mod_carboncopy, config_parser_helper:default_mod_config(mod_carboncopy)}, - {mod_stream_management, config_parser_helper:mod_config(mod_stream_management, #{ack_freq => never})}], + {mod_stream_management, config_parser_helper:mod_config(mod_stream_management, #{ack_freq => never, backend => MemBackend})}], dynamic_modules:ensure_modules(HostType, Modules). apply_steps(Steps, Config) -> From 3a84dabca990ca9e651bcc1058395217d054eb7d Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Fri, 6 Oct 2023 19:02:12 +0200 Subject: [PATCH 05/16] Start mod_muc_light with correct backend in graphql_muc_SUITE --- big_tests/tests/graphql_muc_SUITE.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/big_tests/tests/graphql_muc_SUITE.erl b/big_tests/tests/graphql_muc_SUITE.erl index e50ee5a8b7d..53e0f4d1c77 100644 --- a/big_tests/tests/graphql_muc_SUITE.erl +++ b/big_tests/tests/graphql_muc_SUITE.erl @@ -289,8 +289,9 @@ ensure_muc_stopped() -> muc_helper:unload_muc(SecondaryHostType). ensure_muc_light_started(Config) -> + Backend = mongoose_helper:mnesia_or_rdbms_backend(), MucLightOpts = config_parser_helper:mod_config(mod_muc_light, - #{rooms_in_rosters => true, config_schema => custom_schema()}), + #{backend => Backend, rooms_in_rosters => true, config_schema => custom_schema()}), HostType = domain_helper:host_type(), dynamic_modules:ensure_modules(HostType, [{mod_muc_light, MucLightOpts}]), [{muc_light_host, muc_light_helper:muc_host()} | Config]. From 1e93cbf0d873d24fc6b1717096e7485ca11371cc Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Fri, 6 Oct 2023 19:37:13 +0200 Subject: [PATCH 06/16] Configure graphql_muc_light_SUITE with RDBMS --- big_tests/tests/graphql_muc_light_SUITE.erl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/big_tests/tests/graphql_muc_light_SUITE.erl b/big_tests/tests/graphql_muc_light_SUITE.erl index c9deff69444..3b972184912 100644 --- a/big_tests/tests/graphql_muc_light_SUITE.erl +++ b/big_tests/tests/graphql_muc_light_SUITE.erl @@ -209,7 +209,9 @@ end_per_suite(Config) -> escalus:end_per_suite(Config). required_modules(_) -> - MucLightOpts = mod_config(mod_muc_light, #{rooms_in_rosters => true, + Backend = mongoose_helper:mnesia_or_rdbms_backend(), + MucLightOpts = mod_config(mod_muc_light, #{backend => Backend, + rooms_in_rosters => true, config_schema => custom_schema()}), [{mod_muc_light, MucLightOpts}]. @@ -518,7 +520,7 @@ user_delete_room_story(Config, Alice, Bob) -> AliceBin = escalus_client:short_jid(Alice), BobBin = escalus_client:short_jid(Bob), Name = <<"first room">>, - {ok, #{jid := #jid{luser = RoomID} = RoomJID}} = + {ok, #{jid := #jid{luser = RoomID} = RoomJID} = RoomInfo} = create_room(MUCServer, Name, <<"subject">>, AliceBin), {ok, _} = invite_user(RoomJID, AliceBin, BobBin), % Member cannot delete room @@ -529,7 +531,7 @@ user_delete_room_story(Config, Alice, Bob) -> Res2 = user_delete_room(Alice, jid:to_binary(RoomJID), Config), ?assertNotEqual(nomatch, binary:match(get_ok_value(?DELETE_ROOM_PATH, Res2), <<"successfully">>)), - ?assertEqual({error, not_exists}, get_room_info(jid:from_binary(RoomJID))), + ?assertEqual({error, not_exists}, get_room_info(RoomJID), RoomInfo), % Try with a non-existent domain Res3 = user_delete_room(Alice, make_bare_jid(RoomID, ?UNKNOWN_DOMAIN), Config), ?assertNotEqual(nomatch, binary:match(get_err_msg(Res3), <<"not found">>)), @@ -1290,11 +1292,11 @@ admin_delete_room_story(Config, Alice) -> AliceBin = escalus_client:short_jid(Alice), MUCServer = ?config(muc_light_host, Config), Name = <<"first room">>, - {ok, #{jid := RoomJID}} = create_room(MUCServer, Name, <<"subject">>, AliceBin), + {ok, #{jid := RoomJID} = RoomInfo} = create_room(MUCServer, Name, <<"subject">>, AliceBin), Res = delete_room(jid:to_binary(RoomJID), Config), ?assertNotEqual(nomatch, binary:match(get_ok_value(?DELETE_ROOM_PATH, Res), <<"successfully">>)), - ?assertEqual({error, not_exists}, get_room_info(jid:from_binary(RoomJID))), + ?assertEqual({error, not_exists}, get_room_info(RoomJID), RoomInfo), % Try with a non-existent room Res2 = delete_room(make_bare_jid(?UNKNOWN, MUCServer), Config), ?assertNotEqual(nomatch, binary:match(get_err_msg(Res2), <<"not found">>)). @@ -1721,7 +1723,9 @@ invite_user(RoomJID, SenderBin, RecipientBin) -> RecipientJID = jid:from_binary(RecipientBin), rpc(mim(), mod_muc_light_api, invite_to_room, [RoomJID, SenderJID, RecipientJID]). -get_room_info(JID) -> +get_room_info(error) -> + arg_is_not_jid; +get_room_info(#jid{} = JID) -> HostType = domain_helper:host_type(), RoomUS = jid:to_lus(JID), rpc(mim(), mod_muc_light_db_backend, get_info, [HostType, RoomUS]). From 130b9466892489ad2662a84a97a3f700a3ac8499 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Sat, 7 Oct 2023 13:06:45 +0200 Subject: [PATCH 07/16] Use muc_light with rdbms in mam_SUITE Do not use mnesia mam prefs backend (in case of cets preset) Use fresh names for rooms in muc_light mam cases to avoid race conditions (they were always there, we just started triggering them with rdbms muc_light backend) --- big_tests/tests/mam_SUITE.erl | 38 +++++++++++++++++------------ big_tests/tests/mongoose_helper.erl | 9 +++++++ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/big_tests/tests/mam_SUITE.erl b/big_tests/tests/mam_SUITE.erl index 7663906b1bd..e7a1c0846bc 100644 --- a/big_tests/tests/mam_SUITE.erl +++ b/big_tests/tests/mam_SUITE.erl @@ -221,8 +221,6 @@ -import(domain_helper, [domain/0]). --import(config_parser_helper, [default_mod_config/1]). - -include("mam_helper.hrl"). -include_lib("common_test/include/ct.hrl"). -include_lib("exml/include/exml_stream.hrl"). @@ -244,15 +242,15 @@ configurations() -> %% Called by test-runner for autocompletion all_configurations() -> cassandra_configs(true) - ++ rdbms_configs(true) + ++ rdbms_configs(true, true) ++ elasticsearch_configs(true). configurations_for_running_ct() -> cassandra_configs(is_cassandra_enabled(host_type())) - ++ rdbms_configs(mongoose_helper:is_rdbms_enabled(host_type())) + ++ rdbms_configs(mongoose_helper:is_rdbms_enabled(host_type()), mongoose_helper:is_mnesia_configured()) ++ elasticsearch_configs(is_elasticsearch_enabled(host_type())). -rdbms_configs(true) -> +rdbms_configs(true, true) -> [rdbms, rdbms_easy, rdbms_async_pool, @@ -261,7 +259,14 @@ rdbms_configs(true) -> rdbms_cache, rdbms_mnesia_cache ]; -rdbms_configs(_) -> +rdbms_configs(true, false) -> + [rdbms, + rdbms_easy, + rdbms_async_pool, + rdbms_async_cache, + rdbms_cache + ]; +rdbms_configs(_, _) -> []. cassandra_configs(true) -> @@ -661,7 +666,8 @@ required_modules_for_group(C, muc_light, Config) -> MUCHost = subhost_pattern(muc_light_helper:muc_host_pattern()), Opts = config_opts(Extra#{pm => #{}, muc => #{host => MUCHost}}), Config1 = maybe_set_wait(C, [muc, pm], [{mam_meta_opts, Opts} | Config]), - {[{mod_muc_light, default_mod_config(mod_muc_light)}, + Backend = mongoose_helper:mnesia_or_rdbms_backend(), + {[{mod_muc_light, config_parser_helper:mod_config(mod_muc_light, #{backend => Backend})}, {mod_mam, Opts}], Config1}; required_modules_for_group(C, BG, Config) when BG =:= muc_all; BG =:= muc_disabled_retraction -> @@ -883,7 +889,6 @@ init_per_testcase(C=muc_text_search_request, Config) -> skip_if_cassandra(Config, Init); init_per_testcase(C = muc_light_stored_in_pm_if_allowed_to, Config) -> dynamic_modules:ensure_modules(host_type(), required_modules(C, Config)), - clean_archives(Config), escalus:init_per_testcase(C, Config); init_per_testcase(C, Config) when C =:= muc_light_easy; C =:= muc_light_shouldnt_modify_pm_archive; @@ -901,7 +906,8 @@ init_per_testcase(CaseName, Config) -> escalus:init_per_testcase(CaseName, Config). skip_if_retraction_not_supported(Config, Init) -> - case lists:member(?config(configuration, Config), rdbms_configs(true)) of + ConfList = rdbms_configs(true, mongoose_helper:is_mnesia_configured()), + case lists:member(?config(configuration, Config), ConfList) of false -> {skip, "message retraction not supported"}; true -> @@ -1558,7 +1564,7 @@ muc_querying_for_all_messages_with_jid(Config) -> muc_light_easy(Config) -> escalus:story(Config, [{alice, 1}, {bob, 1}], fun(Alice, Bob) -> - Room = <<"testroom">>, + Room = muc_helper:fresh_room_name(), given_muc_light_room(Room, Alice, []), M1 = when_muc_light_message_is_sent(Alice, Room, @@ -1572,7 +1578,7 @@ muc_light_easy(Config) -> Aff = when_muc_light_affiliations_are_set(Alice, Room, [{Bob, member}]), then_muc_light_affiliations_are_received_by([Alice, Bob], Aff), - maybe_wait_for_archive(Config), + mam_helper:wait_for_room_archive_size(muc_light_host(), Room, 4), when_archive_query_is_sent(Bob, muc_light_helper:room_bin_jid(Room), Config), ExpectedResponse = [{create, [{Alice, owner}]}, {muc_message, Room, Alice, <<"Msg 1">>}, @@ -1583,7 +1589,7 @@ muc_light_easy(Config) -> muc_light_shouldnt_modify_pm_archive(Config) -> escalus:story(Config, [{alice, 1}, {bob, 1}], fun(Alice, Bob) -> - Room = <<"testroom2">>, + Room = muc_helper:fresh_room_name(), given_muc_light_room(Room, Alice, [{Bob, member}]), when_pm_message_is_sent(Alice, Bob, <<"private hi!">>), @@ -1611,8 +1617,8 @@ muc_light_shouldnt_modify_pm_archive(Config) -> end). muc_light_stored_in_pm_if_allowed_to(Config) -> - escalus:story(Config, [{alice, 1}, {bob, 1}], fun(Alice, Bob) -> - Room = <<"testroom_pm">>, + escalus:fresh_story(Config, [{alice, 1}, {bob, 1}], fun(Alice, Bob) -> + Room = muc_helper:fresh_room_name(), given_muc_light_room(Room, Alice, [{Bob, member}]), maybe_wait_for_archive(Config), @@ -1636,7 +1642,7 @@ muc_light_stored_in_pm_if_allowed_to(Config) -> muc_light_chat_markers_are_archived_if_enabled(Config) -> escalus:story(Config, [{alice, 1}, {bob, 1}], fun(Alice, Bob) -> - Room = <<"testroom_markers">>, + Room = muc_helper:fresh_room_name(), given_muc_light_room(Room, Alice, [{Bob, member}]), %% Alice sends 3 chat markers @@ -1664,7 +1670,7 @@ muc_light_chat_markers_are_archived_if_enabled(Config) -> muc_light_chat_markers_are_not_archived_if_disabled(Config) -> escalus:story(Config, [{alice, 1}, {bob, 1}], fun(Alice, Bob) -> - Room = <<"testroom_no_markers">>, + Room = muc_helper:fresh_room_name(), given_muc_light_room(Room, Alice, [{Bob, member}]), %% Alice sends 3 chat markers diff --git a/big_tests/tests/mongoose_helper.erl b/big_tests/tests/mongoose_helper.erl index 53475665f7b..ced261b8586 100644 --- a/big_tests/tests/mongoose_helper.erl +++ b/big_tests/tests/mongoose_helper.erl @@ -6,6 +6,7 @@ %% API -export([is_rdbms_enabled/1, + is_mnesia_configured/0, get_backend_mnesia_rdbms/1, backend_for_module/2, mnesia_or_rdbms_backend/0, @@ -63,6 +64,14 @@ is_rdbms_enabled(HostType) -> _ -> false end. +is_mnesia_configured() -> + case rpc(mim(), mongoose_config, lookup_opt, [[internal_databases, mnesia]]) of + {ok, _} -> + true; + _ -> + false + end. + -spec mnesia_or_rdbms_backend() -> atom(). mnesia_or_rdbms_backend() -> Host = ct:get_config({hosts, mim, domain}), From 2a7ef38f94f89357e1c847909d685a6c99b88283 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Sat, 7 Oct 2023 13:59:22 +0200 Subject: [PATCH 08/16] Use cets in mod_global_distrib_SUITE --- big_tests/tests/mod_global_distrib_SUITE.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/big_tests/tests/mod_global_distrib_SUITE.erl b/big_tests/tests/mod_global_distrib_SUITE.erl index 4682446fcdc..749a5fa8917 100644 --- a/big_tests/tests/mod_global_distrib_SUITE.erl +++ b/big_tests/tests/mod_global_distrib_SUITE.erl @@ -198,7 +198,9 @@ init_modules_per_node({NodeName, LocalHost, ReceiverPort}, Config0) -> mod_stream_management], [dynamic_modules:ensure_stopped(Node, VirtHost, ModulesToStop) || VirtHost <- VirtHosts], - SMOpts = config_parser_helper:mod_config(mod_stream_management, #{resume_timeout => 1}), + SMBackend = mongoose_helper:mnesia_or_cets_backend(Config1), + SMOpts = config_parser_helper:mod_config(mod_stream_management, + #{resume_timeout => 1, backend => SMBackend}), dynamic_modules:ensure_modules(Node, domain(), [{mod_global_distrib, Opts}, {mod_stream_management, SMOpts}]), Config1. From 2e8c6b3d1ff39fb802509cdad4ace2eda1931cb8 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Sat, 7 Oct 2023 14:10:42 +0200 Subject: [PATCH 09/16] Fix backends in mongooseimctl_SUITE --- big_tests/tests/mongooseimctl_SUITE.erl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/big_tests/tests/mongooseimctl_SUITE.erl b/big_tests/tests/mongooseimctl_SUITE.erl index 3ddd7fea645..c4c0f0722e5 100644 --- a/big_tests/tests/mongooseimctl_SUITE.erl +++ b/big_tests/tests/mongooseimctl_SUITE.erl @@ -26,7 +26,7 @@ require_rpc_nodes/1, rpc/4]). -import(domain_helper, [host_type/0, domain/0]). --import(config_parser_helper, [config/2, default_mod_config/1]). +-import(config_parser_helper, [config/2, mod_config/2]). -define(HTTP_UPLOAD_FILENAME, "tmp.txt"). -define(HTTP_UPLOAD_FILESIZE, "5"). @@ -211,10 +211,10 @@ init_per_suite(Config) -> Config1 = ejabberd_node_utils:init(Node, Config), Config2 = escalus:init_per_suite([{ctl_auth_mods, AuthMods}, {roster_template, TemplatePath} | Config1]), - dynamic_modules:ensure_modules(domain_helper:host_type(), [{mod_last, - default_mod_config(mod_last)}]), - dynamic_modules:ensure_modules(domain_helper:secondary_host_type(), - [{mod_last, default_mod_config(mod_last)}]), + Backend = mongoose_helper:mnesia_or_rdbms_backend(), + LastOpts = mod_config(mod_last, #{backend => Backend}), + dynamic_modules:ensure_modules(domain_helper:host_type(), [{mod_last, LastOpts}]), + dynamic_modules:ensure_modules(domain_helper:secondary_host_type(), [{mod_last, LastOpts}]), prepare_roster_template(TemplatePath, domain()), %% dump_and_load requires at least one mnesia table %% ensure, that passwd table is available @@ -236,13 +236,15 @@ end_per_suite(Config) -> escalus:end_per_suite(Config1). init_per_group(basic, Config) -> + Backend = mongoose_helper:mnesia_or_rdbms_backend(), + OfflineOpts = mod_config(mod_offline, #{backend => Backend}), dynamic_modules:ensure_modules(domain_helper:host_type(), - [{mod_offline, default_mod_config(mod_offline)}]), + [{mod_offline, OfflineOpts}]), Config; init_per_group(private, Config) -> - dynamic_modules:ensure_modules(domain_helper:host_type(), - [{mod_private, #{iqdisc => one_queue}}] - ), + Backend = mongoose_helper:mnesia_or_rdbms_backend(), + PrivateOpts = mod_config(mod_private, #{backend => Backend, iqdisc => one_queue}), + dynamic_modules:ensure_modules(domain_helper:host_type(), [{mod_private, PrivateOpts}]), Config; init_per_group(vcard, Config) -> case rpc(mim(), gen_mod, get_module_opt, [host_type(), mod_vcard, backend, mnesia]) of From e64d2b631956671a7a870b3f0b3f7e1a646d9ec2 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Sat, 7 Oct 2023 14:46:09 +0200 Subject: [PATCH 10/16] Start proper backends in domain suites --- big_tests/tests/domain_isolation_SUITE.erl | 3 +- big_tests/tests/domain_removal_SUITE.erl | 39 +++++++++++----------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/big_tests/tests/domain_isolation_SUITE.erl b/big_tests/tests/domain_isolation_SUITE.erl index 63d75b32a89..a25436ffa8e 100644 --- a/big_tests/tests/domain_isolation_SUITE.erl +++ b/big_tests/tests/domain_isolation_SUITE.erl @@ -42,8 +42,9 @@ end_per_suite(Config) -> modules() -> MucHost = subhost_pattern(muc_helper:muc_host_pattern()), + Backend = mongoose_helper:mnesia_or_rdbms_backend(), [{mod_domain_isolation, []}, - {mod_muc_light, mod_config(mod_muc_light, #{host => MucHost})}]. + {mod_muc_light, mod_config(mod_muc_light, #{host => MucHost, backend => Backend})}]. init_per_group(two_domains, Config) -> Config2 = dynamic_modules:save_modules(host_types(), Config), diff --git a/big_tests/tests/domain_removal_SUITE.erl b/big_tests/tests/domain_removal_SUITE.erl index 579376bd6ac..f66fe37c356 100644 --- a/big_tests/tests/domain_removal_SUITE.erl +++ b/big_tests/tests/domain_removal_SUITE.erl @@ -80,7 +80,7 @@ do_init_per_group(auth_removal = Group, Config) -> true -> HostTypes = domain_helper:host_types(), Config2 = dynamic_modules:save_modules(HostTypes, Config), - [dynamic_modules:ensure_modules(HostType, group_to_modules(Group)) || + [dynamic_modules:ensure_modules(HostType, group_to_modules(Group, Config2)) || HostType <- HostTypes], Config2; false -> @@ -91,7 +91,7 @@ do_init_per_group(Group, Config) -> true -> HostTypes = domain_helper:host_types(), Config2 = dynamic_modules:save_modules(HostTypes, Config), - [dynamic_modules:ensure_modules(HostType, group_to_modules(Group)) || + [dynamic_modules:ensure_modules(HostType, group_to_modules(Group, Config)) || HostType <- HostTypes], Config2; false -> @@ -114,42 +114,43 @@ end_per_group(_GroupName, Config) -> end, ok. -group_to_modules(removal_failures) -> - group_to_modules(mam_removal); -group_to_modules(auth_removal) -> +group_to_modules(removal_failures, _Config) -> + group_to_modules(mam_removal, _Config); +group_to_modules(auth_removal, _Config) -> []; -group_to_modules(cache_removal) -> +group_to_modules(cache_removal, _Config) -> [{mod_cache_users, config_parser_helper:default_mod_config(mod_cache_users)}, {mod_mam, mam_helper:config_opts(#{pm => #{}})}]; -group_to_modules(mam_removal) -> +group_to_modules(mam_removal, _Config) -> MucHost = subhost_pattern(muc_light_helper:muc_host_pattern()), [{mod_mam, mam_helper:config_opts(#{pm => #{}, muc => #{host => MucHost}})}, {mod_muc_light, mod_config(mod_muc_light, #{backend => rdbms})}]; -group_to_modules(mam_removal_incremental) -> +group_to_modules(mam_removal_incremental, _Config) -> MucHost = subhost_pattern(muc_light_helper:muc_host_pattern()), [{mod_mam, mam_helper:config_opts(#{delete_domain_limit => 1, pm => #{}, muc => #{host => MucHost}})}, {mod_muc_light, mod_config(mod_muc_light, #{backend => rdbms})}]; -group_to_modules(muc_light_removal) -> +group_to_modules(muc_light_removal, _Config) -> [{mod_muc_light, mod_config(mod_muc_light, #{backend => rdbms})}]; -group_to_modules(muc_removal) -> +group_to_modules(muc_removal, Config) -> MucHost = subhost_pattern(muc_helper:muc_host_pattern()), - Opts = #{backend => rdbms, host => MucHost}, + OnlineBackend = mongoose_helper:mnesia_or_cets_backend(Config), + Opts = #{backend => rdbms, online_backend => OnlineBackend, host => MucHost}, [{mod_muc, muc_helper:make_opts(Opts)}]; -group_to_modules(inbox_removal) -> +group_to_modules(inbox_removal, _Config) -> [{mod_inbox, inbox_helper:inbox_opts()}]; -group_to_modules(inbox_removal_incremental) -> +group_to_modules(inbox_removal_incremental, _Config) -> [{mod_inbox, (inbox_helper:inbox_opts())#{delete_domain_limit => 1}}]; -group_to_modules(private_removal) -> +group_to_modules(private_removal, _Config) -> [{mod_private, #{iqdisc => one_queue, backend => rdbms}}]; -group_to_modules(roster_removal) -> +group_to_modules(roster_removal, _Config) -> [{mod_roster, mod_config(mod_roster, #{backend => rdbms})}]; -group_to_modules(offline_removal) -> +group_to_modules(offline_removal, _Config) -> [{mod_offline, mod_config(mod_offline, #{backend => rdbms})}]; -group_to_modules(markers_removal) -> +group_to_modules(markers_removal, _Config) -> [{mod_smart_markers, config_parser_helper:default_mod_config(mod_smart_markers)}]; -group_to_modules(vcard_removal) -> +group_to_modules(vcard_removal, _Config) -> [{mod_vcard, mod_config(mod_vcard, #{backend => rdbms})}]; -group_to_modules(last_removal) -> +group_to_modules(last_removal, _Config) -> [{mod_last, mod_config(mod_last, #{backend => rdbms})}]. is_internal_or_rdbms() -> From 558878e5f7888f8d74c6b3b901f12c5bfa7b39bc Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Sat, 7 Oct 2023 14:50:50 +0200 Subject: [PATCH 11/16] Start right backends in service_mongoose_system_metrics_SUITE --- .../service_mongoose_system_metrics_SUITE.erl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl index f6e50e14fec..bf6594df64d 100644 --- a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl +++ b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl @@ -134,13 +134,13 @@ init_per_testcase(rdbms_module_opts_are_reported = CN, Config) -> {skip, "RDBMS is not available"}; true -> create_events_collection(), - dynamic_modules:ensure_modules(host_type(), required_modules(CN)), + dynamic_modules:ensure_modules(host_type(), required_modules(CN, Config)), enable_system_metrics(mim()), Config end; init_per_testcase(module_opts_are_reported = CN, Config) -> create_events_collection(), - dynamic_modules:ensure_modules(host_type(), required_modules(CN)), + dynamic_modules:ensure_modules(host_type(), required_modules(CN, Config)), enable_system_metrics(mim()), Config; init_per_testcase(_TestcaseName, Config) -> @@ -331,18 +331,19 @@ in_config_with_explicit_reporting_goes_on_silently(_Config) -> %% Helpers %%-------------------------------------------------------------------- -required_modules(CaseName) -> +required_modules(CaseName, Config) -> lists:filter(fun({Module, _Opts}) -> is_module_supported(Module) end, - modules_to_test(CaseName)). + modules_to_test(CaseName, Config)). -modules_to_test(module_opts_are_reported) -> +modules_to_test(module_opts_are_reported, Config) -> Backend = mongoose_helper:mnesia_or_rdbms_backend(), - [required_module(mod_bosh), + MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), + [required_module(mod_bosh, #{backend => MemBackend}), required_module(mod_event_pusher, #{push => config([modules, mod_event_pusher, push], #{backend => Backend})}), required_module(mod_http_upload, s3), required_module(mod_last, Backend), - required_module(mod_muc, Backend), + required_module(mod_muc, #{backend => Backend, online_backend => MemBackend}), required_module(mod_muc_light, Backend), required_module(mod_offline, Backend), required_module(mod_privacy, Backend), @@ -351,7 +352,7 @@ modules_to_test(module_opts_are_reported) -> required_module(mod_push_service_mongoosepush), required_module(mod_roster, Backend), required_module(mod_vcard, Backend)]; -modules_to_test(rdbms_module_opts_are_reported) -> +modules_to_test(rdbms_module_opts_are_reported, _Config) -> [required_module(mod_auth_token), required_module(mod_inbox), required_module(mod_mam)]. From ff6217bf3a7a42ccb1963109fe4296f77c90886a Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Sat, 7 Oct 2023 15:09:51 +0200 Subject: [PATCH 12/16] Check that mod_muc reports online_backend Fix mod_bosh backend reporting --- .../tests/service_mongoose_system_metrics_SUITE.erl | 10 ++++++---- src/mod_muc.erl | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl index bf6594df64d..e2fe6e89b57 100644 --- a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl +++ b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl @@ -213,15 +213,17 @@ system_metrics_are_reported_to_a_json_file(_Config) -> {ok, File} = rpc(mim(), file, read_file, [ReportFilePath]), jiffy:decode(File). -module_opts_are_reported(_Config) -> +module_opts_are_reported(Config) -> mongoose_helper:wait_until(fun are_modules_reported/0, true), Backend = mongoose_helper:mnesia_or_rdbms_backend(), - check_module_backend(mod_bosh, mnesia), + MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), + check_module_backend(mod_bosh, MemBackend), check_module_backend(mod_event_pusher, push), check_module_backend(mod_event_pusher_push, Backend), check_module_backend(mod_http_upload, s3), check_module_backend(mod_last, Backend), check_module_backend(mod_muc, Backend), + check_module_opt(mod_muc, <<"online_backend">>, atom_to_binary(MemBackend)), check_module_backend(mod_muc_light, Backend), check_module_backend(mod_offline, Backend), check_module_backend(mod_privacy, Backend), @@ -365,10 +367,10 @@ required_module(Module, Backend) when is_atom(Backend) -> required_module(Module, Opts) -> {Module, mod_config(Module, Opts)}. -check_module_opt(Module, Key, Value) -> +check_module_opt(Module, Key, Value) when is_binary(Key), is_binary(Value) -> case is_module_supported(Module) of true -> - ?assertEqual(true, is_module_opt_reported(atom_to_binary(Module), Key, Value)); + ?assert(is_module_opt_reported(atom_to_binary(Module), Key, Value), {Module, Key, Value}); false -> ct:log("Skipping unsupported module ~p", [Module]) end. diff --git a/src/mod_muc.erl b/src/mod_muc.erl index df8bdca195c..c497fa17980 100644 --- a/src/mod_muc.erl +++ b/src/mod_muc.erl @@ -1321,7 +1321,7 @@ ensure_metrics(_Host) -> -spec config_metrics(mongooseim:host_type()) -> [{gen_mod:opt_key(), gen_mod:opt_value()}]. config_metrics(HostType) -> - mongoose_module_metrics:opts_for_module(HostType, ?MODULE, [backend]). + mongoose_module_metrics:opts_for_module(HostType, ?MODULE, [backend, online_backend]). hooks(HostType) -> [{is_muc_room_owner, HostType, fun ?MODULE:is_muc_room_owner/3, #{}, 50}, From 112090a5a3566c7aed6e35475d95c346d8961eb0 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Sat, 7 Oct 2023 15:15:51 +0200 Subject: [PATCH 13/16] Start the right backends in push_integration_SUITE --- big_tests/tests/push_integration_SUITE.erl | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/big_tests/tests/push_integration_SUITE.erl b/big_tests/tests/push_integration_SUITE.erl index 0e634483ea1..49f7103f41e 100644 --- a/big_tests/tests/push_integration_SUITE.erl +++ b/big_tests/tests/push_integration_SUITE.erl @@ -1004,7 +1004,7 @@ getenv(VarName, Default) -> init_modules(G, Config) -> MongoosePushAPI = mongoose_push_api_for_group(G), PubSubHost = ?config(pubsub_host, Config), - Modules = required_modules_for_group(G, MongoosePushAPI, PubSubHost), + Modules = required_modules_for_group(G, MongoosePushAPI, PubSubHost, Config), C = dynamic_modules:save_modules(domain(), Config), Fun = fun() -> catch dynamic_modules:ensure_modules(domain(), Modules) end, mongoose_helper:wait_until(Fun, ok), @@ -1015,27 +1015,32 @@ mongoose_push_api_for_group(failure_cases_v2) -> mongoose_push_api_for_group(_) -> <<"v3">>. -required_modules_for_group(pm_notifications_with_inbox, API, PubSubHost) -> +required_modules_for_group(pm_notifications_with_inbox, API, PubSubHost, _Config) -> Backend = mongoose_helper:mnesia_or_rdbms_backend(), [{mod_inbox, inbox_opts()}, {mod_offline, config_parser_helper:mod_config(mod_offline, #{backend => Backend})} | required_modules(API, PubSubHost)]; -required_modules_for_group(groupchat_notifications_with_inbox, API, PubSubHost)-> +required_modules_for_group(groupchat_notifications_with_inbox, API, PubSubHost, _Config) -> [{mod_inbox, inbox_opts()}, {mod_muc_light, muc_light_opts()} | required_modules(API, PubSubHost)]; -required_modules_for_group(muclight_msg_notifications, API, PubSubHost) -> +required_modules_for_group(muclight_msg_notifications, API, PubSubHost, _Config) -> [{mod_muc_light, muc_light_opts()} | required_modules(API, PubSubHost)]; -required_modules_for_group(integration_with_sm_and_offline_storage, API, PubSubHost) -> +required_modules_for_group(integration_with_sm_and_offline_storage, API, PubSubHost, Config) -> Backend = mongoose_helper:mnesia_or_rdbms_backend(), + MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), [{mod_muc_light, muc_light_opts()}, {mod_stream_management, config_parser_helper:mod_config(mod_stream_management, - #{ack_freq => never, resume_timeout => 1})}, + #{ack_freq => never, resume_timeout => 1, + backend => MemBackend})}, {mod_offline, config_parser_helper:mod_config(mod_offline, #{backend => Backend})} | required_modules(API, PubSubHost)]; -required_modules_for_group(enhanced_integration_with_sm, API, PubSubHost) -> - [{mod_stream_management, config_parser_helper:mod_config(mod_stream_management, #{ack_freq => never})} | +required_modules_for_group(enhanced_integration_with_sm, API, PubSubHost, Config) -> + MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), + [{mod_stream_management, + config_parser_helper:mod_config(mod_stream_management, + #{ack_freq => never, backend => MemBackend})} | required_modules(API, PubSubHost, enhanced_plugin_module_opts())]; -required_modules_for_group(_, API, PubSubHost) -> +required_modules_for_group(_, API, PubSubHost, _Config) -> required_modules(API, PubSubHost). required_modules(API, PubSubHost)-> From 2f90b9951ddae63be92c2b86d94b4b0cb6ffee78 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Sat, 7 Oct 2023 16:22:39 +0200 Subject: [PATCH 14/16] Fix line length in asl2_helper:load_all_sasl2_modules/2 --- big_tests/tests/sasl2_helper.erl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/big_tests/tests/sasl2_helper.erl b/big_tests/tests/sasl2_helper.erl index b1b1d9f4e4e..20d34af1e1c 100644 --- a/big_tests/tests/sasl2_helper.erl +++ b/big_tests/tests/sasl2_helper.erl @@ -9,17 +9,19 @@ -define(NS_SASL_2, <<"urn:xmpp:sasl:2">>). -type step(Config, Client, Data) :: fun((Config, Client, Data) -> {Client, Data}). +-import(config_parser_helper, [mod_config/2, default_mod_config/1]). ns() -> ?NS_SASL_2. load_all_sasl2_modules(HostType, Config) -> MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), - Modules = [{mod_bind2, config_parser_helper:default_mod_config(mod_bind2)}, - {mod_sasl2, config_parser_helper:default_mod_config(mod_sasl2)}, - {mod_csi, config_parser_helper:default_mod_config(mod_csi)}, - {mod_carboncopy, config_parser_helper:default_mod_config(mod_carboncopy)}, - {mod_stream_management, config_parser_helper:mod_config(mod_stream_management, #{ack_freq => never, backend => MemBackend})}], + SMOpts = #{ack_freq => never, backend => MemBackend}, + Modules = [{mod_bind2, default_mod_config(mod_bind2)}, + {mod_sasl2, default_mod_config(mod_sasl2)}, + {mod_csi, default_mod_config(mod_csi)}, + {mod_carboncopy, default_mod_config(mod_carboncopy)}, + {mod_stream_management, mod_config(mod_stream_management, SMOpts)}], dynamic_modules:ensure_modules(HostType, Modules). apply_steps(Steps, Config) -> From 89ec3d7afd9735720cc0d02ff0a5b875449994f1 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Thu, 16 Nov 2023 13:16:50 +0100 Subject: [PATCH 15/16] Replace mnesia_or_cets_backend by get_internal_database --- big_tests/test.config | 1 - big_tests/tests/bosh_SUITE.erl | 4 ++-- big_tests/tests/domain_removal_SUITE.erl | 4 ++-- big_tests/tests/gdpr_SUITE.erl | 8 ++++---- big_tests/tests/mod_global_distrib_SUITE.erl | 2 +- big_tests/tests/mongoose_helper.erl | 4 ---- big_tests/tests/push_integration_SUITE.erl | 8 ++++---- big_tests/tests/sasl2_helper.erl | 4 ++-- big_tests/tests/service_mongoose_system_metrics_SUITE.erl | 8 ++++---- 9 files changed, 19 insertions(+), 24 deletions(-) diff --git a/big_tests/test.config b/big_tests/test.config index f3de0b461a9..42b798fc706 100644 --- a/big_tests/test.config +++ b/big_tests/test.config @@ -241,7 +241,6 @@ workers = 10"}]}, {pgsql_cets, [{dbs, [redis, pgsql]}, - {mnesia_or_cets_backend, cets}, {sm_backend, "\"cets\""}, {bosh_backend, "\"cets\""}, {component_backend, "\"cets\""}, diff --git a/big_tests/tests/bosh_SUITE.erl b/big_tests/tests/bosh_SUITE.erl index 5313d2983b1..a863a336001 100644 --- a/big_tests/tests/bosh_SUITE.erl +++ b/big_tests/tests/bosh_SUITE.erl @@ -153,8 +153,8 @@ end_per_testcase(CaseName, Config) -> required_modules(without_bosh, _Config) -> [{mod_bosh, stopped}]; -required_modules(GroupName, Config) -> - Backend = mongoose_helper:mnesia_or_cets_backend(Config), +required_modules(GroupName, _Config) -> + Backend = ct_helper:get_internal_database(), ModOpts = config_parser_helper:mod_config(mod_bosh, #{backend => Backend}), [{mod_bosh, maps:merge(ModOpts, required_bosh_opts(GroupName))}]. diff --git a/big_tests/tests/domain_removal_SUITE.erl b/big_tests/tests/domain_removal_SUITE.erl index f66fe37c356..ef4667a9a6e 100644 --- a/big_tests/tests/domain_removal_SUITE.erl +++ b/big_tests/tests/domain_removal_SUITE.erl @@ -131,9 +131,9 @@ group_to_modules(mam_removal_incremental, _Config) -> {mod_muc_light, mod_config(mod_muc_light, #{backend => rdbms})}]; group_to_modules(muc_light_removal, _Config) -> [{mod_muc_light, mod_config(mod_muc_light, #{backend => rdbms})}]; -group_to_modules(muc_removal, Config) -> +group_to_modules(muc_removal, _Config) -> MucHost = subhost_pattern(muc_helper:muc_host_pattern()), - OnlineBackend = mongoose_helper:mnesia_or_cets_backend(Config), + OnlineBackend = ct_helper:get_internal_database(), Opts = #{backend => rdbms, online_backend => OnlineBackend, host => MucHost}, [{mod_muc, muc_helper:make_opts(Opts)}]; group_to_modules(inbox_removal, _Config) -> diff --git a/big_tests/tests/gdpr_SUITE.erl b/big_tests/tests/gdpr_SUITE.erl index 9b9a8735c29..966ffd23c2a 100644 --- a/big_tests/tests/gdpr_SUITE.erl +++ b/big_tests/tests/gdpr_SUITE.erl @@ -365,20 +365,20 @@ mam_required_modules(retrieve_mam_pm_and_muc_light_interfere, Backend, _Config) pm => #{archive_groupchats => true}, muc => #{host => HostPattern}})}, {mod_muc_light, mod_config(mod_muc_light, MucLightOpts)}]; -mam_required_modules(CN, Backend, Config) when CN =:= retrieve_mam_muc_private_msg; +mam_required_modules(CN, Backend, _Config) when CN =:= retrieve_mam_muc_private_msg; CN =:= retrieve_mam_muc -> HostPattern = subhost_pattern(muc_helper:muc_host_pattern()), MucOpts = #{host => HostPattern, - online_backend => mongoose_helper:mnesia_or_cets_backend(Config), + online_backend => ct_helper:get_internal_database(), backend => mongoose_helper:mnesia_or_rdbms_backend()}, [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{}, muc => #{host => HostPattern}})}, {mod_muc, muc_helper:make_opts(MucOpts)}]; -mam_required_modules(retrieve_mam_muc_store_pm, Backend, Config) -> +mam_required_modules(retrieve_mam_muc_store_pm, Backend, _Config) -> HostPattern = subhost_pattern(muc_helper:muc_host_pattern()), MucOpts = #{host => HostPattern, - online_backend => mongoose_helper:mnesia_or_cets_backend(Config), + online_backend => ct_helper:get_internal_database(), backend => mongoose_helper:mnesia_or_rdbms_backend()}, [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{archive_groupchats => true}, diff --git a/big_tests/tests/mod_global_distrib_SUITE.erl b/big_tests/tests/mod_global_distrib_SUITE.erl index 749a5fa8917..14b91b6fc64 100644 --- a/big_tests/tests/mod_global_distrib_SUITE.erl +++ b/big_tests/tests/mod_global_distrib_SUITE.erl @@ -198,7 +198,7 @@ init_modules_per_node({NodeName, LocalHost, ReceiverPort}, Config0) -> mod_stream_management], [dynamic_modules:ensure_stopped(Node, VirtHost, ModulesToStop) || VirtHost <- VirtHosts], - SMBackend = mongoose_helper:mnesia_or_cets_backend(Config1), + SMBackend = ct_helper:get_internal_database(), SMOpts = config_parser_helper:mod_config(mod_stream_management, #{resume_timeout => 1, backend => SMBackend}), dynamic_modules:ensure_modules(Node, domain(), [{mod_global_distrib, Opts}, diff --git a/big_tests/tests/mongoose_helper.erl b/big_tests/tests/mongoose_helper.erl index ced261b8586..510c31081fb 100644 --- a/big_tests/tests/mongoose_helper.erl +++ b/big_tests/tests/mongoose_helper.erl @@ -10,7 +10,6 @@ get_backend_mnesia_rdbms/1, backend_for_module/2, mnesia_or_rdbms_backend/0, - mnesia_or_cets_backend/1, get_backend_name/2]). -export([auth_modules/0]). @@ -80,9 +79,6 @@ mnesia_or_rdbms_backend() -> false -> mnesia end. -mnesia_or_cets_backend(Config) -> - ct_helper:get_preset_var(Config, mnesia_or_cets_backend, mnesia). - get_backend_mnesia_rdbms(HostType) -> case is_rdbms_enabled(HostType) of false -> mnesia; diff --git a/big_tests/tests/push_integration_SUITE.erl b/big_tests/tests/push_integration_SUITE.erl index 49f7103f41e..5846d2464f7 100644 --- a/big_tests/tests/push_integration_SUITE.erl +++ b/big_tests/tests/push_integration_SUITE.erl @@ -1025,17 +1025,17 @@ required_modules_for_group(groupchat_notifications_with_inbox, API, PubSubHost, | required_modules(API, PubSubHost)]; required_modules_for_group(muclight_msg_notifications, API, PubSubHost, _Config) -> [{mod_muc_light, muc_light_opts()} | required_modules(API, PubSubHost)]; -required_modules_for_group(integration_with_sm_and_offline_storage, API, PubSubHost, Config) -> +required_modules_for_group(integration_with_sm_and_offline_storage, API, PubSubHost, _Config) -> Backend = mongoose_helper:mnesia_or_rdbms_backend(), - MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), + MemBackend = ct_helper:get_internal_database(), [{mod_muc_light, muc_light_opts()}, {mod_stream_management, config_parser_helper:mod_config(mod_stream_management, #{ack_freq => never, resume_timeout => 1, backend => MemBackend})}, {mod_offline, config_parser_helper:mod_config(mod_offline, #{backend => Backend})} | required_modules(API, PubSubHost)]; -required_modules_for_group(enhanced_integration_with_sm, API, PubSubHost, Config) -> - MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), +required_modules_for_group(enhanced_integration_with_sm, API, PubSubHost, _Config) -> + MemBackend = ct_helper:get_internal_database(), [{mod_stream_management, config_parser_helper:mod_config(mod_stream_management, #{ack_freq => never, backend => MemBackend})} | diff --git a/big_tests/tests/sasl2_helper.erl b/big_tests/tests/sasl2_helper.erl index 20d34af1e1c..7eeff0b0e76 100644 --- a/big_tests/tests/sasl2_helper.erl +++ b/big_tests/tests/sasl2_helper.erl @@ -14,8 +14,8 @@ ns() -> ?NS_SASL_2. -load_all_sasl2_modules(HostType, Config) -> - MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), +load_all_sasl2_modules(HostType, _Config) -> + MemBackend = ct_helper:get_internal_database(), SMOpts = #{ack_freq => never, backend => MemBackend}, Modules = [{mod_bind2, default_mod_config(mod_bind2)}, {mod_sasl2, default_mod_config(mod_sasl2)}, diff --git a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl index e2fe6e89b57..938cf7e7b6e 100644 --- a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl +++ b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl @@ -213,10 +213,10 @@ system_metrics_are_reported_to_a_json_file(_Config) -> {ok, File} = rpc(mim(), file, read_file, [ReportFilePath]), jiffy:decode(File). -module_opts_are_reported(Config) -> +module_opts_are_reported(_Config) -> mongoose_helper:wait_until(fun are_modules_reported/0, true), Backend = mongoose_helper:mnesia_or_rdbms_backend(), - MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), + MemBackend = ct_helper:get_internal_database(), check_module_backend(mod_bosh, MemBackend), check_module_backend(mod_event_pusher, push), check_module_backend(mod_event_pusher_push, Backend), @@ -337,9 +337,9 @@ required_modules(CaseName, Config) -> lists:filter(fun({Module, _Opts}) -> is_module_supported(Module) end, modules_to_test(CaseName, Config)). -modules_to_test(module_opts_are_reported, Config) -> +modules_to_test(module_opts_are_reported, _Config) -> Backend = mongoose_helper:mnesia_or_rdbms_backend(), - MemBackend = mongoose_helper:mnesia_or_cets_backend(Config), + MemBackend = ct_helper:get_internal_database(), [required_module(mod_bosh, #{backend => MemBackend}), required_module(mod_event_pusher, #{push => config([modules, mod_event_pusher, push], #{backend => Backend})}), From a44cbf84ec6957b86b4de686ddbb3da44aeb0df6 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Fri, 17 Nov 2023 10:50:37 +0100 Subject: [PATCH 16/16] Review: remove redundant parameters and return values --- big_tests/tests/bind2_SUITE.erl | 2 +- big_tests/tests/bosh_SUITE.erl | 14 ++++---- big_tests/tests/domain_removal_SUITE.erl | 36 +++++++++---------- big_tests/tests/gdpr_SUITE.erl | 12 +++---- big_tests/tests/mam_SUITE.erl | 10 +++--- big_tests/tests/mongoose_helper.erl | 9 ----- big_tests/tests/push_integration_SUITE.erl | 14 ++++---- big_tests/tests/sasl2_SUITE.erl | 2 +- big_tests/tests/sasl2_helper.erl | 2 +- .../service_mongoose_system_metrics_SUITE.erl | 12 +++---- 10 files changed, 52 insertions(+), 61 deletions(-) diff --git a/big_tests/tests/bind2_SUITE.erl b/big_tests/tests/bind2_SUITE.erl index 397b02d2c52..73d5170a887 100644 --- a/big_tests/tests/bind2_SUITE.erl +++ b/big_tests/tests/bind2_SUITE.erl @@ -68,7 +68,7 @@ end_per_testcase(Name, Config) -> load_modules(Config) -> HostType = domain_helper:host_type(), Config1 = dynamic_modules:save_modules(HostType, Config), - sasl2_helper:load_all_sasl2_modules(HostType, Config1), + sasl2_helper:load_all_sasl2_modules(HostType), Config1. %%-------------------------------------------------------------------- diff --git a/big_tests/tests/bosh_SUITE.erl b/big_tests/tests/bosh_SUITE.erl index a863a336001..6f7d5f1d6bb 100644 --- a/big_tests/tests/bosh_SUITE.erl +++ b/big_tests/tests/bosh_SUITE.erl @@ -116,21 +116,21 @@ end_per_suite(Config) -> escalus:end_per_suite(Config). init_per_group(time, Config) -> - dynamic_modules:ensure_modules(host_type(), required_modules(time, Config)), + dynamic_modules:ensure_modules(host_type(), required_modules(time)), Config; init_per_group(GroupName, Config) when GroupName =:= essential; GroupName =:= without_bosh -> - dynamic_modules:ensure_modules(host_type(), required_modules(GroupName, Config)), + dynamic_modules:ensure_modules(host_type(), required_modules(GroupName)), [{user, carol} | Config]; init_per_group(essential_https, Config) -> - dynamic_modules:ensure_modules(host_type(), required_modules(essential_https, Config)), + dynamic_modules:ensure_modules(host_type(), required_modules(essential_https)), [{user, carol_s} | Config]; init_per_group(chat_https, Config) -> - dynamic_modules:ensure_modules(host_type(), required_modules(chat_https, Config)), + dynamic_modules:ensure_modules(host_type(), required_modules(chat_https)), Config1 = escalus:create_users(Config, escalus:get_users([carol, carol_s, geralt, alice])), [{user, carol_s} | Config1]; init_per_group(GroupName, Config) -> - dynamic_modules:ensure_modules(host_type(), required_modules(GroupName, Config)), + dynamic_modules:ensure_modules(host_type(), required_modules(GroupName)), Config1 = escalus:create_users(Config, escalus:get_users([carol, carol_s, geralt, alice])), [{user, carol} | Config1]. @@ -151,9 +151,9 @@ end_per_testcase(CaseName, Config) -> %% Module configuration per group -required_modules(without_bosh, _Config) -> +required_modules(without_bosh) -> [{mod_bosh, stopped}]; -required_modules(GroupName, _Config) -> +required_modules(GroupName) -> Backend = ct_helper:get_internal_database(), ModOpts = config_parser_helper:mod_config(mod_bosh, #{backend => Backend}), [{mod_bosh, maps:merge(ModOpts, required_bosh_opts(GroupName))}]. diff --git a/big_tests/tests/domain_removal_SUITE.erl b/big_tests/tests/domain_removal_SUITE.erl index ef4667a9a6e..089285f3f1a 100644 --- a/big_tests/tests/domain_removal_SUITE.erl +++ b/big_tests/tests/domain_removal_SUITE.erl @@ -80,7 +80,7 @@ do_init_per_group(auth_removal = Group, Config) -> true -> HostTypes = domain_helper:host_types(), Config2 = dynamic_modules:save_modules(HostTypes, Config), - [dynamic_modules:ensure_modules(HostType, group_to_modules(Group, Config2)) || + [dynamic_modules:ensure_modules(HostType, group_to_modules(Group)) || HostType <- HostTypes], Config2; false -> @@ -91,7 +91,7 @@ do_init_per_group(Group, Config) -> true -> HostTypes = domain_helper:host_types(), Config2 = dynamic_modules:save_modules(HostTypes, Config), - [dynamic_modules:ensure_modules(HostType, group_to_modules(Group, Config)) || + [dynamic_modules:ensure_modules(HostType, group_to_modules(Group)) || HostType <- HostTypes], Config2; false -> @@ -114,43 +114,43 @@ end_per_group(_GroupName, Config) -> end, ok. -group_to_modules(removal_failures, _Config) -> - group_to_modules(mam_removal, _Config); -group_to_modules(auth_removal, _Config) -> +group_to_modules(removal_failures) -> + group_to_modules(mam_removal); +group_to_modules(auth_removal) -> []; -group_to_modules(cache_removal, _Config) -> +group_to_modules(cache_removal) -> [{mod_cache_users, config_parser_helper:default_mod_config(mod_cache_users)}, {mod_mam, mam_helper:config_opts(#{pm => #{}})}]; -group_to_modules(mam_removal, _Config) -> +group_to_modules(mam_removal) -> MucHost = subhost_pattern(muc_light_helper:muc_host_pattern()), [{mod_mam, mam_helper:config_opts(#{pm => #{}, muc => #{host => MucHost}})}, {mod_muc_light, mod_config(mod_muc_light, #{backend => rdbms})}]; -group_to_modules(mam_removal_incremental, _Config) -> +group_to_modules(mam_removal_incremental) -> MucHost = subhost_pattern(muc_light_helper:muc_host_pattern()), [{mod_mam, mam_helper:config_opts(#{delete_domain_limit => 1, pm => #{}, muc => #{host => MucHost}})}, {mod_muc_light, mod_config(mod_muc_light, #{backend => rdbms})}]; -group_to_modules(muc_light_removal, _Config) -> +group_to_modules(muc_light_removal) -> [{mod_muc_light, mod_config(mod_muc_light, #{backend => rdbms})}]; -group_to_modules(muc_removal, _Config) -> +group_to_modules(muc_removal) -> MucHost = subhost_pattern(muc_helper:muc_host_pattern()), OnlineBackend = ct_helper:get_internal_database(), Opts = #{backend => rdbms, online_backend => OnlineBackend, host => MucHost}, [{mod_muc, muc_helper:make_opts(Opts)}]; -group_to_modules(inbox_removal, _Config) -> +group_to_modules(inbox_removal) -> [{mod_inbox, inbox_helper:inbox_opts()}]; -group_to_modules(inbox_removal_incremental, _Config) -> +group_to_modules(inbox_removal_incremental) -> [{mod_inbox, (inbox_helper:inbox_opts())#{delete_domain_limit => 1}}]; -group_to_modules(private_removal, _Config) -> +group_to_modules(private_removal) -> [{mod_private, #{iqdisc => one_queue, backend => rdbms}}]; -group_to_modules(roster_removal, _Config) -> +group_to_modules(roster_removal) -> [{mod_roster, mod_config(mod_roster, #{backend => rdbms})}]; -group_to_modules(offline_removal, _Config) -> +group_to_modules(offline_removal) -> [{mod_offline, mod_config(mod_offline, #{backend => rdbms})}]; -group_to_modules(markers_removal, _Config) -> +group_to_modules(markers_removal) -> [{mod_smart_markers, config_parser_helper:default_mod_config(mod_smart_markers)}]; -group_to_modules(vcard_removal, _Config) -> +group_to_modules(vcard_removal) -> [{mod_vcard, mod_config(mod_vcard, #{backend => rdbms})}]; -group_to_modules(last_removal, _Config) -> +group_to_modules(last_removal) -> [{mod_last, mod_config(mod_last, #{backend => rdbms})}]. is_internal_or_rdbms() -> diff --git a/big_tests/tests/gdpr_SUITE.erl b/big_tests/tests/gdpr_SUITE.erl index 966ffd23c2a..f563d9df085 100644 --- a/big_tests/tests/gdpr_SUITE.erl +++ b/big_tests/tests/gdpr_SUITE.erl @@ -281,7 +281,7 @@ init_per_testcase(CN, Config) when CN =:= retrieve_mam_muc; {skip, no_mam_backend_configured}; Backend -> dynamic_modules:restore_modules(Config), - RequiredModules = mam_required_modules(CN, Backend, Config), + RequiredModules = mam_required_modules(CN, Backend), dynamic_modules:ensure_modules(host_type(), RequiredModules), ct:log("required modules: ~p~n", [RequiredModules]), escalus:init_per_testcase(CN, [{mam_modules, RequiredModules} | Config]) @@ -344,11 +344,11 @@ groupchat_module(muclight) -> #{backend => mongoose_helper:mnesia_or_rdbms_backend(), rooms_in_rosters => true})}]. -mam_required_modules(CN, Backend, _Config) +mam_required_modules(CN, Backend) when CN =:= remove_mam_pm; CN =:= retrieve_mam_pm -> [{mod_mam, mam_helper:config_opts(#{backend => Backend, pm => #{}})}]; -mam_required_modules(CN, Backend, _Config) +mam_required_modules(CN, Backend) when CN =:= retrieve_mam_pm_and_muc_light_dont_interfere; CN =:= retrieve_mam_muc_light -> HostPattern = subhost_pattern(muc_light_helper:muc_host_pattern()), @@ -357,7 +357,7 @@ mam_required_modules(CN, Backend, _Config) pm => #{}, muc => #{host => HostPattern}})}, {mod_muc_light, mod_config(mod_muc_light, MucLightOpts)}]; -mam_required_modules(retrieve_mam_pm_and_muc_light_interfere, Backend, _Config) -> +mam_required_modules(retrieve_mam_pm_and_muc_light_interfere, Backend) -> HostPattern = subhost_pattern(muc_light_helper:muc_host_pattern()), MucLightOpts = #{backend => mongoose_helper:mnesia_or_rdbms_backend()}, [{mod_mam, mam_helper:config_opts(#{backend => Backend, @@ -365,7 +365,7 @@ mam_required_modules(retrieve_mam_pm_and_muc_light_interfere, Backend, _Config) pm => #{archive_groupchats => true}, muc => #{host => HostPattern}})}, {mod_muc_light, mod_config(mod_muc_light, MucLightOpts)}]; -mam_required_modules(CN, Backend, _Config) when CN =:= retrieve_mam_muc_private_msg; +mam_required_modules(CN, Backend) when CN =:= retrieve_mam_muc_private_msg; CN =:= retrieve_mam_muc -> HostPattern = subhost_pattern(muc_helper:muc_host_pattern()), MucOpts = #{host => HostPattern, @@ -375,7 +375,7 @@ mam_required_modules(CN, Backend, _Config) when CN =:= retrieve_mam_muc_private_ pm => #{}, muc => #{host => HostPattern}})}, {mod_muc, muc_helper:make_opts(MucOpts)}]; -mam_required_modules(retrieve_mam_muc_store_pm, Backend, _Config) -> +mam_required_modules(retrieve_mam_muc_store_pm, Backend) -> HostPattern = subhost_pattern(muc_helper:muc_host_pattern()), MucOpts = #{host => HostPattern, online_backend => ct_helper:get_internal_database(), diff --git a/big_tests/tests/mam_SUITE.erl b/big_tests/tests/mam_SUITE.erl index e7a1c0846bc..078a8408179 100644 --- a/big_tests/tests/mam_SUITE.erl +++ b/big_tests/tests/mam_SUITE.erl @@ -242,15 +242,15 @@ configurations() -> %% Called by test-runner for autocompletion all_configurations() -> cassandra_configs(true) - ++ rdbms_configs(true, true) + ++ rdbms_configs(true, mnesia) ++ elasticsearch_configs(true). configurations_for_running_ct() -> cassandra_configs(is_cassandra_enabled(host_type())) - ++ rdbms_configs(mongoose_helper:is_rdbms_enabled(host_type()), mongoose_helper:is_mnesia_configured()) + ++ rdbms_configs(mongoose_helper:is_rdbms_enabled(host_type()), ct_helper:get_internal_database()) ++ elasticsearch_configs(is_elasticsearch_enabled(host_type())). -rdbms_configs(true, true) -> +rdbms_configs(true, mnesia) -> [rdbms, rdbms_easy, rdbms_async_pool, @@ -259,7 +259,7 @@ rdbms_configs(true, true) -> rdbms_cache, rdbms_mnesia_cache ]; -rdbms_configs(true, false) -> +rdbms_configs(true, cets) -> [rdbms, rdbms_easy, rdbms_async_pool, @@ -906,7 +906,7 @@ init_per_testcase(CaseName, Config) -> escalus:init_per_testcase(CaseName, Config). skip_if_retraction_not_supported(Config, Init) -> - ConfList = rdbms_configs(true, mongoose_helper:is_mnesia_configured()), + ConfList = rdbms_configs(true, ct_helper:get_internal_database()), case lists:member(?config(configuration, Config), ConfList) of false -> {skip, "message retraction not supported"}; diff --git a/big_tests/tests/mongoose_helper.erl b/big_tests/tests/mongoose_helper.erl index 510c31081fb..93aa4248d2c 100644 --- a/big_tests/tests/mongoose_helper.erl +++ b/big_tests/tests/mongoose_helper.erl @@ -6,7 +6,6 @@ %% API -export([is_rdbms_enabled/1, - is_mnesia_configured/0, get_backend_mnesia_rdbms/1, backend_for_module/2, mnesia_or_rdbms_backend/0, @@ -63,14 +62,6 @@ is_rdbms_enabled(HostType) -> _ -> false end. -is_mnesia_configured() -> - case rpc(mim(), mongoose_config, lookup_opt, [[internal_databases, mnesia]]) of - {ok, _} -> - true; - _ -> - false - end. - -spec mnesia_or_rdbms_backend() -> atom(). mnesia_or_rdbms_backend() -> Host = ct:get_config({hosts, mim, domain}), diff --git a/big_tests/tests/push_integration_SUITE.erl b/big_tests/tests/push_integration_SUITE.erl index 5846d2464f7..0498afb9570 100644 --- a/big_tests/tests/push_integration_SUITE.erl +++ b/big_tests/tests/push_integration_SUITE.erl @@ -1004,7 +1004,7 @@ getenv(VarName, Default) -> init_modules(G, Config) -> MongoosePushAPI = mongoose_push_api_for_group(G), PubSubHost = ?config(pubsub_host, Config), - Modules = required_modules_for_group(G, MongoosePushAPI, PubSubHost, Config), + Modules = required_modules_for_group(G, MongoosePushAPI, PubSubHost), C = dynamic_modules:save_modules(domain(), Config), Fun = fun() -> catch dynamic_modules:ensure_modules(domain(), Modules) end, mongoose_helper:wait_until(Fun, ok), @@ -1015,17 +1015,17 @@ mongoose_push_api_for_group(failure_cases_v2) -> mongoose_push_api_for_group(_) -> <<"v3">>. -required_modules_for_group(pm_notifications_with_inbox, API, PubSubHost, _Config) -> +required_modules_for_group(pm_notifications_with_inbox, API, PubSubHost) -> Backend = mongoose_helper:mnesia_or_rdbms_backend(), [{mod_inbox, inbox_opts()}, {mod_offline, config_parser_helper:mod_config(mod_offline, #{backend => Backend})} | required_modules(API, PubSubHost)]; -required_modules_for_group(groupchat_notifications_with_inbox, API, PubSubHost, _Config) -> +required_modules_for_group(groupchat_notifications_with_inbox, API, PubSubHost) -> [{mod_inbox, inbox_opts()}, {mod_muc_light, muc_light_opts()} | required_modules(API, PubSubHost)]; -required_modules_for_group(muclight_msg_notifications, API, PubSubHost, _Config) -> +required_modules_for_group(muclight_msg_notifications, API, PubSubHost) -> [{mod_muc_light, muc_light_opts()} | required_modules(API, PubSubHost)]; -required_modules_for_group(integration_with_sm_and_offline_storage, API, PubSubHost, _Config) -> +required_modules_for_group(integration_with_sm_and_offline_storage, API, PubSubHost) -> Backend = mongoose_helper:mnesia_or_rdbms_backend(), MemBackend = ct_helper:get_internal_database(), [{mod_muc_light, muc_light_opts()}, @@ -1034,13 +1034,13 @@ required_modules_for_group(integration_with_sm_and_offline_storage, API, PubSubH backend => MemBackend})}, {mod_offline, config_parser_helper:mod_config(mod_offline, #{backend => Backend})} | required_modules(API, PubSubHost)]; -required_modules_for_group(enhanced_integration_with_sm, API, PubSubHost, _Config) -> +required_modules_for_group(enhanced_integration_with_sm, API, PubSubHost) -> MemBackend = ct_helper:get_internal_database(), [{mod_stream_management, config_parser_helper:mod_config(mod_stream_management, #{ack_freq => never, backend => MemBackend})} | required_modules(API, PubSubHost, enhanced_plugin_module_opts())]; -required_modules_for_group(_, API, PubSubHost, _Config) -> +required_modules_for_group(_, API, PubSubHost) -> required_modules(API, PubSubHost). required_modules(API, PubSubHost)-> diff --git a/big_tests/tests/sasl2_SUITE.erl b/big_tests/tests/sasl2_SUITE.erl index cadd58b84df..3866ef13809 100644 --- a/big_tests/tests/sasl2_SUITE.erl +++ b/big_tests/tests/sasl2_SUITE.erl @@ -88,7 +88,7 @@ end_per_testcase(Name, Config) -> load_sasl_extensible(Config) -> HostType = domain_helper:host_type(), Config1 = dynamic_modules:save_modules(HostType, Config), - sasl2_helper:load_all_sasl2_modules(HostType, Config1), + sasl2_helper:load_all_sasl2_modules(HostType), Config1. %%-------------------------------------------------------------------- diff --git a/big_tests/tests/sasl2_helper.erl b/big_tests/tests/sasl2_helper.erl index 7eeff0b0e76..e33c893f28a 100644 --- a/big_tests/tests/sasl2_helper.erl +++ b/big_tests/tests/sasl2_helper.erl @@ -14,7 +14,7 @@ ns() -> ?NS_SASL_2. -load_all_sasl2_modules(HostType, _Config) -> +load_all_sasl2_modules(HostType) -> MemBackend = ct_helper:get_internal_database(), SMOpts = #{ack_freq => never, backend => MemBackend}, Modules = [{mod_bind2, default_mod_config(mod_bind2)}, diff --git a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl index 938cf7e7b6e..8be8f667bf3 100644 --- a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl +++ b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl @@ -134,13 +134,13 @@ init_per_testcase(rdbms_module_opts_are_reported = CN, Config) -> {skip, "RDBMS is not available"}; true -> create_events_collection(), - dynamic_modules:ensure_modules(host_type(), required_modules(CN, Config)), + dynamic_modules:ensure_modules(host_type(), required_modules(CN)), enable_system_metrics(mim()), Config end; init_per_testcase(module_opts_are_reported = CN, Config) -> create_events_collection(), - dynamic_modules:ensure_modules(host_type(), required_modules(CN, Config)), + dynamic_modules:ensure_modules(host_type(), required_modules(CN)), enable_system_metrics(mim()), Config; init_per_testcase(_TestcaseName, Config) -> @@ -333,11 +333,11 @@ in_config_with_explicit_reporting_goes_on_silently(_Config) -> %% Helpers %%-------------------------------------------------------------------- -required_modules(CaseName, Config) -> +required_modules(CaseName) -> lists:filter(fun({Module, _Opts}) -> is_module_supported(Module) end, - modules_to_test(CaseName, Config)). + modules_to_test(CaseName)). -modules_to_test(module_opts_are_reported, _Config) -> +modules_to_test(module_opts_are_reported) -> Backend = mongoose_helper:mnesia_or_rdbms_backend(), MemBackend = ct_helper:get_internal_database(), [required_module(mod_bosh, #{backend => MemBackend}), @@ -354,7 +354,7 @@ modules_to_test(module_opts_are_reported, _Config) -> required_module(mod_push_service_mongoosepush), required_module(mod_roster, Backend), required_module(mod_vcard, Backend)]; -modules_to_test(rdbms_module_opts_are_reported, _Config) -> +modules_to_test(rdbms_module_opts_are_reported) -> [required_module(mod_auth_token), required_module(mod_inbox), required_module(mod_mam)].