From ffc71aef8306f3d86fa6bb6968136bab96167433 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Tue, 23 Nov 2021 16:31:50 +0100 Subject: [PATCH 01/14] Disable mod_private in dev nodes --- rel/fed1.vars-toml.config | 1 + rel/mim1.vars-toml.config | 1 + rel/mim2.vars-toml.config | 1 + rel/mim3.vars-toml.config | 1 + rel/reg1.vars-toml.config | 1 + 5 files changed, 5 insertions(+) diff --git a/rel/fed1.vars-toml.config b/rel/fed1.vars-toml.config index 8ca79fe2b6..26df51f50b 100644 --- a/rel/fed1.vars-toml.config +++ b/rel/fed1.vars-toml.config @@ -52,3 +52,4 @@ {s2s_dhfile, "\"priv/ssl/fake_dh_server.pem\""}. {mod_last, false}. +{mod_private, false}. diff --git a/rel/mim1.vars-toml.config b/rel/mim1.vars-toml.config index be09a92e10..fda7fefdd4 100644 --- a/rel/mim1.vars-toml.config +++ b/rel/mim1.vars-toml.config @@ -83,6 +83,7 @@ {mod_cache_users, " time_to_live = 2 number_of_segments = 5\n"}. {mod_last, false}. +{mod_private, false}. {zlib, "10_000"}. {c2s_dhfile, "\"priv/ssl/fake_dh_server.pem\""}. {s2s_dhfile, "\"priv/ssl/fake_dh_server.pem\""}. diff --git a/rel/mim2.vars-toml.config b/rel/mim2.vars-toml.config index 921298bfe8..408ef4b95f 100644 --- a/rel/mim2.vars-toml.config +++ b/rel/mim2.vars-toml.config @@ -61,3 +61,4 @@ {mod_cache_users, false}. {mod_last, false}. +{mod_private, false}. diff --git a/rel/mim3.vars-toml.config b/rel/mim3.vars-toml.config index 4e341b4900..1badfa91f5 100644 --- a/rel/mim3.vars-toml.config +++ b/rel/mim3.vars-toml.config @@ -47,3 +47,4 @@ {mod_cache_users, false}. {mod_last, false}. +{mod_private, false}. diff --git a/rel/reg1.vars-toml.config b/rel/reg1.vars-toml.config index ef8233542d..a728676a0b 100644 --- a/rel/reg1.vars-toml.config +++ b/rel/reg1.vars-toml.config @@ -46,3 +46,4 @@ {s2s_dhfile, "\"priv/ssl/fake_dh_server.pem\""}. {mod_last, false}. +{mod_private, false}. From 441d5abb15caaf466bc59b0f7748b8fd4d7f4b99 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Tue, 23 Nov 2021 16:37:35 +0100 Subject: [PATCH 02/14] Disable mod_private default in presets --- big_tests/test.config | 4 ---- 1 file changed, 4 deletions(-) diff --git a/big_tests/test.config b/big_tests/test.config index 9df7bf821d..3308c35309 100644 --- a/big_tests/test.config +++ b/big_tests/test.config @@ -256,7 +256,6 @@ connection.tls.server_name_indication = false"}, {service_domain_db, ""}, {mod_privacy, " backend = \"rdbms\"\n"}, - {mod_private, " backend = \"rdbms\"\n"}, {mod_offline, " backend = \"rdbms\"\n"}, {mod_vcard, " backend = \"rdbms\" host = \"vjud.@HOST@\"\n"}, @@ -275,7 +274,6 @@ connection.settings = \"DSN=mongoose-mssql;UID=sa;PWD=mongooseim_secret+ESL123\""}, {service_domain_db, ""}, {mod_privacy, " backend = \"rdbms\"\n"}, - {mod_private, " backend = \"rdbms\"\n"}, {mod_offline, " backend = \"rdbms\"\n"}, {mod_vcard, " backend = \"rdbms\" host = \"vjud.@HOST@\"\n"}, @@ -304,7 +302,6 @@ connection.tls.versions = [\"tlsv1.2\"]"}, {service_domain_db, ""}, {mod_privacy, " backend = \"rdbms\"\n"}, - {mod_private, " backend = \"rdbms\"\n"}, {mod_offline, " backend = \"rdbms\"\n"}, {mod_vcard, " backend = \"rdbms\" host = \"vjud.@HOST@\"\n"}, @@ -367,7 +364,6 @@ connection.tls.server_name_indication = false connection.tls.cacertfile = \"priv/ssl/cacert.pem\""}, {mod_privacy, " backend = \"riak\"\n"}, - {mod_private, " backend = \"riak\"\n"}, {mod_offline, " backend = \"riak\"\n"}, {mod_vcard, " backend = \"riak\" host = \"vjud.@HOST@\"\n"}, From ffa780108fee110bab5c8c0a2a94723b1729bd7c Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 00:07:33 +0100 Subject: [PATCH 03/14] Extract common helper function --- big_tests/tests/last_SUITE.erl | 9 +-------- big_tests/tests/mongoose_helper.erl | 8 ++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/big_tests/tests/last_SUITE.erl b/big_tests/tests/last_SUITE.erl index 070c44ab5f..43f9c1c30a 100644 --- a/big_tests/tests/last_SUITE.erl +++ b/big_tests/tests/last_SUITE.erl @@ -44,7 +44,7 @@ suite() -> init_per_suite(Config0) -> HostType = domain_helper:host_type(), Config1 = dynamic_modules:save_modules(HostType, Config0), - Backend = get_configured_backend(HostType), + Backend = mongoose_helper:get_backend_mnesia_rdbms_riak(HostType), dynamic_modules:ensure_modules(HostType, required_modules(Backend)), escalus:init_per_suite([{backend, Backend} | Config1]). @@ -162,12 +162,5 @@ get_last_activity(Stanza) -> get_last_status(Stanza) -> exml_query:path(Stanza, [{element, <<"query">>}, cdata]). -get_configured_backend(HostType) -> - case {mongoose_helper:is_rdbms_enabled(HostType), mam_helper:is_riak_enabled(HostType)} of - {false, false} -> mnesia; - {true, false} -> rdbms; - {false, true} -> riak - end. - required_modules(Backend) -> [{mod_last, [{backend, Backend}]}]. diff --git a/big_tests/tests/mongoose_helper.erl b/big_tests/tests/mongoose_helper.erl index 7d1fdc3fa1..c64052addb 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, + get_backend_mnesia_rdbms_riak/1, mnesia_or_rdbms_backend/0, get_backend_name/2]). @@ -64,6 +65,13 @@ mnesia_or_rdbms_backend() -> false -> mnesia end. +get_backend_mnesia_rdbms_riak(HostType) -> + case {is_rdbms_enabled(HostType), mam_helper:is_riak_enabled(HostType)} of + {false, false} -> mnesia; + {true, false} -> rdbms; + {false, true} -> riak + end. + -spec auth_modules() -> [atom()]. auth_modules() -> Hosts = rpc(mim(), mongoose_config, get_opt, [hosts]), From c1a3465c30ab3310b395a9bdb82f34afdb8d9ea6 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 00:08:09 +0100 Subject: [PATCH 04/14] Use mod_private only in the suite that needs it --- big_tests/tests/gdpr_SUITE.erl | 3 +++ big_tests/tests/mongooseimctl_SUITE.erl | 6 ++++++ big_tests/tests/private_SUITE.erl | 11 +++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/big_tests/tests/gdpr_SUITE.erl b/big_tests/tests/gdpr_SUITE.erl index fb88828a15..70913b353d 100644 --- a/big_tests/tests/gdpr_SUITE.erl +++ b/big_tests/tests/gdpr_SUITE.erl @@ -214,6 +214,9 @@ init_per_group(retrieve_personal_data_inbox = GN, Config) -> init_inbox(GN, Config, muclight); init_per_group(remove_personal_data_inbox = GN, Config) -> init_inbox(GN, Config, muclight); +init_per_group(retrieve_personal_data_private_xml, Config) -> + private_started(), + Config; init_per_group(_GN, Config) -> Config. diff --git a/big_tests/tests/mongooseimctl_SUITE.erl b/big_tests/tests/mongooseimctl_SUITE.erl index e6ab8295b8..6c60c3f09f 100644 --- a/big_tests/tests/mongooseimctl_SUITE.erl +++ b/big_tests/tests/mongooseimctl_SUITE.erl @@ -215,6 +215,9 @@ end_per_suite(Config) -> dynamic_modules:stop(domain_helper:secondary_host_type(), mod_last), escalus:end_per_suite(Config1). +init_per_group(private, Config) -> + dynamic_modules:ensure_modules(domain_helper:host_type(), [{mod_private, []}]), + Config; init_per_group(vcard, Config) -> case rpc(mim(), gen_mod, get_module_opt, [host_type(), mod_vcard, backend, mnesia]) of ldap -> @@ -238,6 +241,9 @@ init_per_group(upload_with_acl, Config) -> init_per_group(_GroupName, Config) -> Config. +end_per_group(private, Config) -> + dynamic_modules:stop(domain_helper:host_type(), mod_private), + Config; end_per_group(Rosters, Config) when (Rosters == roster) or (Rosters == roster_advanced) -> TemplatePath = escalus_config:get_config(roster_template, Config), RegUsers = [atom_to_list(U) || {U, _} <- escalus_config:get_config(escalus_users, Config)], diff --git a/big_tests/tests/private_SUITE.erl b/big_tests/tests/private_SUITE.erl index 832e7009c7..5400cc7219 100644 --- a/big_tests/tests/private_SUITE.erl +++ b/big_tests/tests/private_SUITE.erl @@ -44,10 +44,15 @@ negative_test_cases() -> suite() -> escalus:suite(). -init_per_suite(Config) -> - escalus:init_per_suite(Config). +init_per_suite(Config0) -> + HostType = domain_helper:host_type(), + Config1 = dynamic_modules:save_modules(HostType, Config0), + Backend = mongoose_helper:get_backend_mnesia_rdbms_riak(HostType), + dynamic_modules:ensure_modules(HostType, required_modules(Backend)), + escalus:init_per_suite([{backend, Backend} | Config1]). end_per_suite(Config) -> + dynamic_modules:restore_modules(Config), escalus:end_per_suite(Config). init_per_group(_GroupName, Config) -> @@ -167,3 +172,5 @@ check_body_rec(Element, [Name | Names]) -> Name = Child#xmlel.name, check_body_rec(Child, Names). +required_modules(Backend) -> + [{mod_private, [{backend, Backend}]}]. From 136bb0836ed5c764de6aeee41ea34f9f0ec1f45c Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 12:58:15 +0100 Subject: [PATCH 05/14] Disable mod_privacy and mod_blocking in dev nodes --- rel/fed1.vars-toml.config | 2 ++ rel/mim1.vars-toml.config | 4 ++-- rel/mim2.vars-toml.config | 2 ++ rel/mim3.vars-toml.config | 2 ++ rel/reg1.vars-toml.config | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rel/fed1.vars-toml.config b/rel/fed1.vars-toml.config index 26df51f50b..ab46370458 100644 --- a/rel/fed1.vars-toml.config +++ b/rel/fed1.vars-toml.config @@ -53,3 +53,5 @@ {mod_last, false}. {mod_private, false}. +{mod_privacy, false}. +{mod_blocking, false}. diff --git a/rel/mim1.vars-toml.config b/rel/mim1.vars-toml.config index fda7fefdd4..bb096cd4e0 100644 --- a/rel/mim1.vars-toml.config +++ b/rel/mim1.vars-toml.config @@ -8,8 +8,6 @@ {host_types, "\"test type\", \"dummy auth\", \"anonymous\""}. {default_server_domain, "\"localhost\""}. -{mod_privacy, ""}. -{mod_blocking, ""}. {mod_amp, ""}. {host_config, "[[host_config]] @@ -84,6 +82,8 @@ number_of_segments = 5\n"}. {mod_last, false}. {mod_private, false}. +{mod_privacy, false}. +{mod_blocking, false}. {zlib, "10_000"}. {c2s_dhfile, "\"priv/ssl/fake_dh_server.pem\""}. {s2s_dhfile, "\"priv/ssl/fake_dh_server.pem\""}. diff --git a/rel/mim2.vars-toml.config b/rel/mim2.vars-toml.config index 408ef4b95f..f03a2bbc7c 100644 --- a/rel/mim2.vars-toml.config +++ b/rel/mim2.vars-toml.config @@ -62,3 +62,5 @@ {mod_cache_users, false}. {mod_last, false}. {mod_private, false}. +{mod_privacy, false}. +{mod_blocking, false}. diff --git a/rel/mim3.vars-toml.config b/rel/mim3.vars-toml.config index 1badfa91f5..01867acd12 100644 --- a/rel/mim3.vars-toml.config +++ b/rel/mim3.vars-toml.config @@ -48,3 +48,5 @@ {mod_cache_users, false}. {mod_last, false}. {mod_private, false}. +{mod_privacy, false}. +{mod_blocking, false}. diff --git a/rel/reg1.vars-toml.config b/rel/reg1.vars-toml.config index a728676a0b..480911fa06 100644 --- a/rel/reg1.vars-toml.config +++ b/rel/reg1.vars-toml.config @@ -47,3 +47,5 @@ {mod_last, false}. {mod_private, false}. +{mod_privacy, false}. +{mod_blocking, false}. From 34aad308d7c9e1170966087bb6951128f81717d2 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 12:59:02 +0100 Subject: [PATCH 06/14] Disable mod_privacy and mod_blocking default in presets --- big_tests/test.config | 4 ---- 1 file changed, 4 deletions(-) diff --git a/big_tests/test.config b/big_tests/test.config index 3308c35309..2286839eb6 100644 --- a/big_tests/test.config +++ b/big_tests/test.config @@ -255,7 +255,6 @@ connection.tls.cacertfile = \"priv/ssl/cacert.pem\" connection.tls.server_name_indication = false"}, {service_domain_db, ""}, - {mod_privacy, " backend = \"rdbms\"\n"}, {mod_offline, " backend = \"rdbms\"\n"}, {mod_vcard, " backend = \"rdbms\" host = \"vjud.@HOST@\"\n"}, @@ -273,7 +272,6 @@ connection.driver = \"odbc\" connection.settings = \"DSN=mongoose-mssql;UID=sa;PWD=mongooseim_secret+ESL123\""}, {service_domain_db, ""}, - {mod_privacy, " backend = \"rdbms\"\n"}, {mod_offline, " backend = \"rdbms\"\n"}, {mod_vcard, " backend = \"rdbms\" host = \"vjud.@HOST@\"\n"}, @@ -301,7 +299,6 @@ connection.tls.cacertfile = \"priv/ssl/cacert.pem\" connection.tls.versions = [\"tlsv1.2\"]"}, {service_domain_db, ""}, - {mod_privacy, " backend = \"rdbms\"\n"}, {mod_offline, " backend = \"rdbms\"\n"}, {mod_vcard, " backend = \"rdbms\" host = \"vjud.@HOST@\"\n"}, @@ -363,7 +360,6 @@ connection.tls.ciphers = \"AES256-SHA:DHE-RSA-AES128-SHA256\" connection.tls.server_name_indication = false connection.tls.cacertfile = \"priv/ssl/cacert.pem\""}, - {mod_privacy, " backend = \"riak\"\n"}, {mod_offline, " backend = \"riak\"\n"}, {mod_vcard, " backend = \"riak\" host = \"vjud.@HOST@\"\n"}, From 4a3aa5d968a7021c3a689773708407418edbc454 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 13:03:07 +0100 Subject: [PATCH 07/14] Extract common helper function --- big_tests/tests/mongoose_helper.erl | 4 ++++ big_tests/tests/private_SUITE.erl | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/big_tests/tests/mongoose_helper.erl b/big_tests/tests/mongoose_helper.erl index c64052addb..51452cb21d 100644 --- a/big_tests/tests/mongoose_helper.erl +++ b/big_tests/tests/mongoose_helper.erl @@ -7,6 +7,7 @@ -export([is_rdbms_enabled/1, get_backend_mnesia_rdbms_riak/1, + backend_for_module/2, mnesia_or_rdbms_backend/0, get_backend_name/2]). @@ -72,6 +73,9 @@ get_backend_mnesia_rdbms_riak(HostType) -> {false, true} -> riak end. +backend_for_module(Module, Backend) -> + [{Module, [{backend, Backend}]}]. + -spec auth_modules() -> [atom()]. auth_modules() -> Hosts = rpc(mim(), mongoose_config, get_opt, [hosts]), diff --git a/big_tests/tests/private_SUITE.erl b/big_tests/tests/private_SUITE.erl index 5400cc7219..aba107b9b2 100644 --- a/big_tests/tests/private_SUITE.erl +++ b/big_tests/tests/private_SUITE.erl @@ -48,7 +48,8 @@ init_per_suite(Config0) -> HostType = domain_helper:host_type(), Config1 = dynamic_modules:save_modules(HostType, Config0), Backend = mongoose_helper:get_backend_mnesia_rdbms_riak(HostType), - dynamic_modules:ensure_modules(HostType, required_modules(Backend)), + ModConfig = mongoose_helper:backend_for_module(mod_privacy, Backend), + dynamic_modules:ensure_modules(HostType, ModConfig), escalus:init_per_suite([{backend, Backend} | Config1]). end_per_suite(Config) -> From 8e41ac3d983490f860d6670a76b3d1394e3437ed Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 13:03:38 +0100 Subject: [PATCH 08/14] Use mod_privacy and mod_blocking only in the suite that needs it --- big_tests/tests/amp_big_SUITE.erl | 13 ++++++++++--- big_tests/tests/mod_blocking_SUITE.erl | 13 +++++++++---- big_tests/tests/privacy_SUITE.erl | 13 ++++++++++--- big_tests/tests/private_SUITE.erl | 2 +- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/big_tests/tests/amp_big_SUITE.erl b/big_tests/tests/amp_big_SUITE.erl index 6278a1d51d..1d11f7afbe 100644 --- a/big_tests/tests/amp_big_SUITE.erl +++ b/big_tests/tests/amp_big_SUITE.erl @@ -979,11 +979,11 @@ is_module_loaded(Mod) -> rpc(mim(), gen_mod, is_loaded, [host_type(), Mod]). required_modules(basic) -> - mam_modules(off) ++ offline_modules(off); + mam_modules(off) ++ offline_modules(off) ++ privacy_modules(on); required_modules(mam) -> - mam_modules(on) ++ offline_modules(off); + mam_modules(on) ++ offline_modules(off) ++ privacy_modules(off); required_modules(offline) -> - mam_modules(off) ++ offline_modules(on); + mam_modules(off) ++ offline_modules(on) ++ privacy_modules(on); required_modules(_) -> []. @@ -1000,3 +1000,10 @@ offline_modules(on) -> offline_modules(off) -> [{mod_offline, stopped}, {mod_offline_stub, []}]. + +privacy_modules(on) -> + [{mod_privacy, []}, + {mod_blocking, []}]; +privacy_modules(off) -> + [{mod_privacy, stopped}, + {mod_blocking, stopped}]. diff --git a/big_tests/tests/mod_blocking_SUITE.erl b/big_tests/tests/mod_blocking_SUITE.erl index 830b96c8dc..0867882f3c 100644 --- a/big_tests/tests/mod_blocking_SUITE.erl +++ b/big_tests/tests/mod_blocking_SUITE.erl @@ -97,13 +97,18 @@ suite() -> %% Init & teardown %%-------------------------------------------------------------------- -init_per_suite(Config) -> - escalus:init_per_suite(Config). -%% [{escalus_no_stanzas_after_story, true} | -%% escalus:init_per_suite(Config)]. +init_per_suite(Config0) -> + HostType = domain_helper:host_type(), + Config1 = dynamic_modules:save_modules(HostType, Config0), + Backend = mongoose_helper:get_backend_mnesia_rdbms_riak(HostType), + ModConfig = mongoose_helper:backend_for_module(mod_blocking, Backend), + dynamic_modules:ensure_modules(HostType, ModConfig), + [{backend, Backend} | + escalus:init_per_suite(Config1)]. end_per_suite(Config) -> escalus_fresh:clean(), + dynamic_modules:restore_modules(Config), escalus:end_per_suite(Config). init_per_group(_GroupName, Config) -> diff --git a/big_tests/tests/privacy_SUITE.erl b/big_tests/tests/privacy_SUITE.erl index 39b188225d..0eb9f88dcf 100644 --- a/big_tests/tests/privacy_SUITE.erl +++ b/big_tests/tests/privacy_SUITE.erl @@ -89,12 +89,19 @@ suite() -> %% Init & teardown %%-------------------------------------------------------------------- -init_per_suite(Config) -> - [{escalus_no_stanzas_after_story, true} | - escalus:init_per_suite(Config)]. +init_per_suite(Config0) -> + HostType = domain_helper:host_type(), + Config1 = dynamic_modules:save_modules(HostType, Config0), + Backend = mongoose_helper:get_backend_mnesia_rdbms_riak(HostType), + ModConfig = mongoose_helper:backend_for_module(mod_privacy, Backend), + dynamic_modules:ensure_modules(HostType, ModConfig), + [{escalus_no_stanzas_after_story, true}, + {backend, Backend} | + escalus:init_per_suite(Config1)]. end_per_suite(Config) -> escalus_fresh:clean(), + dynamic_modules:restore_modules(Config), escalus:end_per_suite(Config). init_per_group(_GroupName, Config) -> diff --git a/big_tests/tests/private_SUITE.erl b/big_tests/tests/private_SUITE.erl index aba107b9b2..7dab2f5869 100644 --- a/big_tests/tests/private_SUITE.erl +++ b/big_tests/tests/private_SUITE.erl @@ -48,7 +48,7 @@ init_per_suite(Config0) -> HostType = domain_helper:host_type(), Config1 = dynamic_modules:save_modules(HostType, Config0), Backend = mongoose_helper:get_backend_mnesia_rdbms_riak(HostType), - ModConfig = mongoose_helper:backend_for_module(mod_privacy, Backend), + ModConfig = mongoose_helper:backend_for_module(mod_private, Backend), dynamic_modules:ensure_modules(HostType, ModConfig), escalus:init_per_suite([{backend, Backend} | Config1]). From 67a242f8b75749aa0cb10fd5b773603fe94248b7 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 15:02:05 +0100 Subject: [PATCH 09/14] Disable mod_offline in dev nodes --- rel/fed1.vars-toml.config | 1 + rel/mim1.vars-toml.config | 1 + rel/mim2.vars-toml.config | 1 + rel/mim3.vars-toml.config | 1 + rel/reg1.vars-toml.config | 1 + 5 files changed, 5 insertions(+) diff --git a/rel/fed1.vars-toml.config b/rel/fed1.vars-toml.config index ab46370458..f748fc5afd 100644 --- a/rel/fed1.vars-toml.config +++ b/rel/fed1.vars-toml.config @@ -55,3 +55,4 @@ {mod_private, false}. {mod_privacy, false}. {mod_blocking, false}. +{mod_offline, false}. diff --git a/rel/mim1.vars-toml.config b/rel/mim1.vars-toml.config index bb096cd4e0..8c775bde16 100644 --- a/rel/mim1.vars-toml.config +++ b/rel/mim1.vars-toml.config @@ -84,6 +84,7 @@ {mod_private, false}. {mod_privacy, false}. {mod_blocking, false}. +{mod_offline, false}. {zlib, "10_000"}. {c2s_dhfile, "\"priv/ssl/fake_dh_server.pem\""}. {s2s_dhfile, "\"priv/ssl/fake_dh_server.pem\""}. diff --git a/rel/mim2.vars-toml.config b/rel/mim2.vars-toml.config index f03a2bbc7c..1d5afc86c3 100644 --- a/rel/mim2.vars-toml.config +++ b/rel/mim2.vars-toml.config @@ -64,3 +64,4 @@ {mod_private, false}. {mod_privacy, false}. {mod_blocking, false}. +{mod_offline, false}. diff --git a/rel/mim3.vars-toml.config b/rel/mim3.vars-toml.config index 01867acd12..db33fbb2c1 100644 --- a/rel/mim3.vars-toml.config +++ b/rel/mim3.vars-toml.config @@ -50,3 +50,4 @@ {mod_private, false}. {mod_privacy, false}. {mod_blocking, false}. +{mod_offline, false}. diff --git a/rel/reg1.vars-toml.config b/rel/reg1.vars-toml.config index 480911fa06..82264bf8be 100644 --- a/rel/reg1.vars-toml.config +++ b/rel/reg1.vars-toml.config @@ -49,3 +49,4 @@ {mod_private, false}. {mod_privacy, false}. {mod_blocking, false}. +{mod_offline, false}. From 5a4df62bf0f9e231e05a415765e5a6866b21da88 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 15:02:27 +0100 Subject: [PATCH 10/14] Disable mod_offline default in presets --- big_tests/test.config | 4 ---- 1 file changed, 4 deletions(-) diff --git a/big_tests/test.config b/big_tests/test.config index 2286839eb6..563d5de8be 100644 --- a/big_tests/test.config +++ b/big_tests/test.config @@ -255,7 +255,6 @@ connection.tls.cacertfile = \"priv/ssl/cacert.pem\" connection.tls.server_name_indication = false"}, {service_domain_db, ""}, - {mod_offline, " backend = \"rdbms\"\n"}, {mod_vcard, " backend = \"rdbms\" host = \"vjud.@HOST@\"\n"}, {mod_roster, " backend = \"rdbms\"\n"}]}, @@ -272,7 +271,6 @@ connection.driver = \"odbc\" connection.settings = \"DSN=mongoose-mssql;UID=sa;PWD=mongooseim_secret+ESL123\""}, {service_domain_db, ""}, - {mod_offline, " backend = \"rdbms\"\n"}, {mod_vcard, " backend = \"rdbms\" host = \"vjud.@HOST@\"\n"}, {mod_roster, " backend = \"rdbms\"\n"}]}, @@ -299,7 +297,6 @@ connection.tls.cacertfile = \"priv/ssl/cacert.pem\" connection.tls.versions = [\"tlsv1.2\"]"}, {service_domain_db, ""}, - {mod_offline, " backend = \"rdbms\"\n"}, {mod_vcard, " backend = \"rdbms\" host = \"vjud.@HOST@\"\n"}, {mod_roster, " backend = \"rdbms\"\n"}]}, @@ -360,7 +357,6 @@ connection.tls.ciphers = \"AES256-SHA:DHE-RSA-AES128-SHA256\" connection.tls.server_name_indication = false connection.tls.cacertfile = \"priv/ssl/cacert.pem\""}, - {mod_offline, " backend = \"riak\"\n"}, {mod_vcard, " backend = \"riak\" host = \"vjud.@HOST@\"\n"}, {mod_roster, " backend = \"riak\"\n"} From d2f7af44c27661a41dc8ac607196eb2e601b9524 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 16:17:25 +0100 Subject: [PATCH 11/14] Use mod_offline only in the suites that needs it --- big_tests/tests/gdpr_SUITE.erl | 7 ++++--- big_tests/tests/mod_event_pusher_http_SUITE.erl | 10 ++++++---- big_tests/tests/offline_SUITE.erl | 15 +++++++++++++-- big_tests/tests/push_integration_SUITE.erl | 4 +++- big_tests/tests/sm_SUITE.erl | 4 ++-- big_tests/tests/xep_0352_csi_SUITE.erl | 8 +++++--- 6 files changed, 33 insertions(+), 15 deletions(-) diff --git a/big_tests/tests/gdpr_SUITE.erl b/big_tests/tests/gdpr_SUITE.erl index 70913b353d..7c8bb2ca03 100644 --- a/big_tests/tests/gdpr_SUITE.erl +++ b/big_tests/tests/gdpr_SUITE.erl @@ -240,7 +240,8 @@ init_per_testcase(retrieve_logs = CN, Config) -> false -> {skip, not_running_in_distributed}; _ -> escalus:init_per_testcase(CN, Config) end; -init_per_testcase(remove_offline = CN, Config) -> +init_per_testcase(CN, Config) when CN =:= remove_offline; + CN =:= retrieve_offline -> offline_started(), escalus:init_per_testcase(CN, Config); init_per_testcase(CN, Config) when @@ -314,7 +315,7 @@ init_per_testcase(CN, Config) -> end_per_testcase(CN, Config) when CN =:= retrieve_mam_muc_light; CN =:= retrieve_mam_pm_and_muc_light_interfere; CN =:= retrieve_mam_pm_and_muc_light_dont_interfere -> - muc_light_helper:clear_db(), + muc_light_helper:clear_db(host_type()), escalus:end_per_testcase(CN, Config); %% mod_inbox end_per_testcase(CN, Config) when @@ -322,7 +323,7 @@ end_per_testcase(CN, Config) when CN =:= retrieve_inbox; CN =:= remove_inbox_muclight; CN =:= retrieve_inbox_muclight -> - muc_light_helper:clear_db(), + muc_light_helper:clear_db(host_type()), escalus:end_per_testcase(CN, Config); end_per_testcase(CN, Config) when CN =:= retrieve_inbox_muc; CN =:= remove_inbox_muc -> diff --git a/big_tests/tests/mod_event_pusher_http_SUITE.erl b/big_tests/tests/mod_event_pusher_http_SUITE.erl index 42751a4cce..9af4979e2c 100644 --- a/big_tests/tests/mod_event_pusher_http_SUITE.erl +++ b/big_tests/tests/mod_event_pusher_http_SUITE.erl @@ -22,7 +22,7 @@ -import(push_helper, [http_notifications_port/0, http_notifications_host/0]). --import(domain_helper, [domain/0]). +-import(domain_helper, [host_type/0]). %%%=================================================================== %%% Suite configuration @@ -63,7 +63,7 @@ init_per_group(with_prefix, Config) -> set_modules(Config, [{path, "/prefix"}]). end_per_group(_GroupName, Config) -> - dynamic_modules:restore_modules(domain(), Config), + dynamic_modules:restore_modules(host_type(), Config), ok. init_per_testcase(CaseName, Config) -> @@ -177,12 +177,14 @@ stop_pool() -> ejabberd_node_utils:call_fun(mongoose_wpool, stop, [http, global, http_pool]). set_modules(Config0, Opts) -> - Config = dynamic_modules:save_modules(domain(), Config0), + Config = dynamic_modules:save_modules(host_type(), Config0), + Backend = mongoose_helper:get_backend_mnesia_rdbms_riak(host_type()), + ModOffline = mongoose_helper:backend_for_module(mod_offline, Backend), ModOpts = [{backends, [{http, [{worker_timeout, 500}, {host, http_notifications_host()}] ++ Opts}]}], - dynamic_modules:ensure_modules(domain(), [{mod_event_pusher, ModOpts}]), + dynamic_modules:ensure_modules(host_type(), [{mod_event_pusher, ModOpts} | ModOffline]), Config. start_http_listener(simple_message, Prefix) -> diff --git a/big_tests/tests/offline_SUITE.erl b/big_tests/tests/offline_SUITE.erl index fc281657a7..c36da37367 100644 --- a/big_tests/tests/offline_SUITE.erl +++ b/big_tests/tests/offline_SUITE.erl @@ -55,8 +55,19 @@ suite() -> %%% Init & teardown %%%=================================================================== -init_per_suite(C) -> escalus:init_per_suite(C). -end_per_suite(C) -> escalus_fresh:clean(), escalus:end_per_suite(C). +init_per_suite(Config0) -> + HostType = domain_helper:host_type(), + Config1 = dynamic_modules:save_modules(HostType, Config0), + Backend = mongoose_helper:get_backend_mnesia_rdbms_riak(HostType), + ModConfig = mongoose_helper:backend_for_module(mod_offline, Backend), + dynamic_modules:ensure_modules(HostType, ModConfig), + [{backend, Backend} | + escalus:init_per_suite(Config1)]. + +end_per_suite(Config) -> + escalus_fresh:clean(), + dynamic_modules:restore_modules(Config), + escalus:end_per_suite(Config). init_per_group(with_groupchat, C) -> Config = dynamic_modules:save_modules(host_type(), C), diff --git a/big_tests/tests/push_integration_SUITE.erl b/big_tests/tests/push_integration_SUITE.erl index 12a78bcb46..4c7db3fb0c 100644 --- a/big_tests/tests/push_integration_SUITE.erl +++ b/big_tests/tests/push_integration_SUITE.erl @@ -964,7 +964,9 @@ mongoose_push_api_for_group(_) -> "v3". required_modules_for_group(pm_notifications_with_inbox, API, PubSubHost) -> - [{mod_inbox, inbox_opts()} | required_modules(API, PubSubHost)]; + [{mod_inbox, inbox_opts()}, + {mod_offline, []} | + required_modules(API, PubSubHost)]; required_modules_for_group(groupchat_notifications_with_inbox, API, PubSubHost)-> [{mod_inbox, inbox_opts()}, {mod_muc_light, muc_light_opts()} | required_modules(API, PubSubHost)]; diff --git a/big_tests/tests/sm_SUITE.erl b/big_tests/tests/sm_SUITE.erl index 2eab9832ab..23100eb26d 100644 --- a/big_tests/tests/sm_SUITE.erl +++ b/big_tests/tests/sm_SUITE.erl @@ -120,8 +120,8 @@ init_per_suite(Config) -> escalus:init_per_suite(NewConfigWithSM). end_per_suite(Config) -> - dynamic_modules:restore_modules(Config), escalus_fresh:clean(), + dynamic_modules:restore_modules(Config), escalus:end_per_suite(Config). init_per_group(Group, Config) when Group =:= unacknowledged_message_hook; @@ -178,7 +178,7 @@ required_modules(Scope, Name) -> stopped -> stopped; ExtraOpts -> common_sm_opts() ++ ExtraOpts end, - [{mod_stream_management, SMConfig}]. + [{mod_stream_management, SMConfig}, {mod_offline, []}]. required_sm_opts(group, parallel) -> [{ack_freq, never}]; diff --git a/big_tests/tests/xep_0352_csi_SUITE.erl b/big_tests/tests/xep_0352_csi_SUITE.erl index c0f162e3bd..01f5573cf3 100644 --- a/big_tests/tests/xep_0352_csi_SUITE.erl +++ b/big_tests/tests/xep_0352_csi_SUITE.erl @@ -33,12 +33,14 @@ suite() -> escalus:suite(). init_per_suite(Config) -> - dynamic_modules:start(host_type(), mod_csi, [{buffer_max, ?CSI_BUFFER_MAX}]), - [{escalus_user_db, {module, escalus_ejabberd}} | escalus:init_per_suite(Config)]. + NewConfig = dynamic_modules:save_modules(host_type(), Config), + dynamic_modules:ensure_modules( + host_type(), [{mod_offline, []}, {mod_csi, [{buffer_max, ?CSI_BUFFER_MAX}]}]), + [{escalus_user_db, {module, escalus_ejabberd}} | escalus:init_per_suite(NewConfig)]. end_per_suite(Config) -> - dynamic_modules:stop(host_type(), mod_csi), escalus_fresh:clean(), + dynamic_modules:restore_modules(Config), escalus:end_per_suite(Config). init_per_group(_, Config) -> From 7ae65f130ba7c52aaf8b7a5ea62706831852e35d Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 18:41:01 +0100 Subject: [PATCH 12/14] Fix inbox test configuration --- big_tests/tests/inbox_SUITE.erl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/big_tests/tests/inbox_SUITE.erl b/big_tests/tests/inbox_SUITE.erl index fb67c3354f..1b4a258cf7 100644 --- a/big_tests/tests/inbox_SUITE.erl +++ b/big_tests/tests/inbox_SUITE.erl @@ -196,9 +196,10 @@ suite() -> %% Init & teardown %%-------------------------------------------------------------------- -init_per_suite(Config) -> +init_per_suite(Config0) -> + Config1 = dynamic_modules:save_modules(domain_helper:host_type(), Config0), ok = dynamic_modules:ensure_modules( - domain_helper:host_type(mim), inbox_modules()), + domain_helper:host_type(), inbox_modules()), ok = dynamic_modules:ensure_modules( ct:get_config({hosts, mim, secondary_host_type}), [{mod_inbox, @@ -207,18 +208,16 @@ init_per_suite(Config) -> {groupchat, [muclight]}, {markers, [displayed]}]}]), InboxOptions = inbox_opts(), - Config1 = escalus:init_per_suite(Config), - [{inbox_opts, InboxOptions} | Config1]. + escalus:init_per_suite([{inbox_opts, InboxOptions} | Config1]). end_per_suite(Config) -> - dynamic_modules:stop( - domain_helper:host_type(mim), mod_inbox), - dynamic_modules:stop( - ct:get_config({hosts, mim, secondary_host_type}), mod_inbox), escalus_fresh:clean(), + dynamic_modules:stop(ct:get_config({hosts, mim, secondary_host_type}), mod_inbox), + dynamic_modules:restore_modules(domain_helper:host_type(), Config), escalus:end_per_suite(Config). init_per_group(one_to_one, Config) -> + dynamic_modules:ensure_modules(domain_helper:host_type(), [{mod_offline, []}]), inbox_helper:reload_inbox_option(Config, groupchat, []); init_per_group(muclight, Config) -> ok = dynamic_modules:ensure_modules(domain_helper:host_type(mim), muclight_modules()), From d89f6582b999c69c9117aeb17a2212c3ff34e14d Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 18:41:23 +0100 Subject: [PATCH 13/14] Enable offline in mongooseimctl tests --- big_tests/tests/mongooseimctl_SUITE.erl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/big_tests/tests/mongooseimctl_SUITE.erl b/big_tests/tests/mongooseimctl_SUITE.erl index 6c60c3f09f..55887c4c9c 100644 --- a/big_tests/tests/mongooseimctl_SUITE.erl +++ b/big_tests/tests/mongooseimctl_SUITE.erl @@ -215,6 +215,9 @@ end_per_suite(Config) -> dynamic_modules:stop(domain_helper:secondary_host_type(), mod_last), escalus:end_per_suite(Config1). +init_per_group(basic, Config) -> + dynamic_modules:ensure_modules(domain_helper:host_type(), [{mod_offline, []}]), + Config; init_per_group(private, Config) -> dynamic_modules:ensure_modules(domain_helper:host_type(), [{mod_private, []}]), Config; @@ -241,6 +244,9 @@ init_per_group(upload_with_acl, Config) -> init_per_group(_GroupName, Config) -> Config. +end_per_group(basic, Config) -> + dynamic_modules:stop(domain_helper:host_type(), mod_offline), + Config; end_per_group(private, Config) -> dynamic_modules:stop(domain_helper:host_type(), mod_private), Config; From 272c6feb6d813a5a990c76f1acc80162545b2d0a Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 24 Nov 2021 21:10:06 +0100 Subject: [PATCH 14/14] First clean users, then deactivate modules they might have used --- big_tests/tests/gdpr_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/big_tests/tests/gdpr_SUITE.erl b/big_tests/tests/gdpr_SUITE.erl index 7c8bb2ca03..2a3d4a9c25 100644 --- a/big_tests/tests/gdpr_SUITE.erl +++ b/big_tests/tests/gdpr_SUITE.erl @@ -191,8 +191,8 @@ init_per_suite(Config) -> end_per_suite(Config) -> delete_files(), - dynamic_modules:restore_modules(host_type(), Config), escalus_fresh:clean(), + dynamic_modules:restore_modules(host_type(), Config), escalus:end_per_suite(Config). init_per_group(GN, Config) when GN =:= remove_personal_data_mam_rdbms;