From 807728afff86119ccb546e8d15c16703e1cd516d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Fri, 15 Nov 2024 10:03:58 +0100 Subject: [PATCH 1/2] Test the case when MAM user prefs are disabled - Add a configuration without prefs for regression tests. Disable prefs-related tests when prefs are disabled. - Add a test to check that disabling prefs is effective. It seems enough to just check PM (no MUC test). --- big_tests/tests/mam_SUITE.erl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/big_tests/tests/mam_SUITE.erl b/big_tests/tests/mam_SUITE.erl index c05d3c27f9a..dbea55c9dab 100644 --- a/big_tests/tests/mam_SUITE.erl +++ b/big_tests/tests/mam_SUITE.erl @@ -173,6 +173,7 @@ rdbms_configs(true, mnesia) -> ]; rdbms_configs(true, cets) -> [rdbms, + rdbms_no_prefs, rdbms_easy, rdbms_async_pool, rdbms_async_cache, @@ -199,6 +200,7 @@ basic_group_names() -> muc_light, prefs_cases, muc_prefs_cases, + no_prefs_cases, impl_specific, disabled_text_search, disabled_complex_queries, @@ -233,6 +235,10 @@ groups() -> || C <- configurations(), {G, Props, Tests} <- basic_groups(), not is_skipped(C, G)]. +is_skipped(rdbms_no_prefs, G) -> + G =:= prefs_cases orelse G =:= muc_prefs_cases; +is_skipped(_, no_prefs_cases) -> + true; is_skipped(_, _) -> false. @@ -275,6 +281,7 @@ basic_groups() -> {muc_light, [], muc_light_cases()}, {prefs_cases, [parallel], prefs_cases()}, {muc_prefs_cases, [parallel], muc_prefs_cases()}, + {no_prefs_cases, [parallel], no_prefs_cases()}, {impl_specific, [], impl_specific()}, {disabled_text_search, [], [{mam04, [], disabled_text_search_cases()}]}, @@ -509,6 +516,9 @@ muc_prefs_cases() -> muc_messages_filtered_when_prefs_default_policy_is_never, muc_messages_filtered_when_prefs_default_policy_is_roster]. +no_prefs_cases() -> + [prefs_disabled_set_request]. + impl_specific() -> [check_user_exist, pm_failed_to_decode_message_in_database, @@ -762,6 +772,9 @@ mam_opts_for_conf(rdbms_easy) -> EasyOpts = #{db_jid_format => mam_jid_rfc, db_message_format => mam_message_xml}, maps:merge(EasyOpts, mam_opts_for_conf(rdbms)); +mam_opts_for_conf(rdbms_no_prefs) -> + #{async_writer => #{enabled => false}, + cache_users => false}; mam_opts_for_conf(rdbms) -> #{user_prefs_store => rdbms, async_writer => #{enabled => false}, @@ -3547,6 +3560,18 @@ prefs_set_request(Config) -> end, escalus:fresh_story(Config, [{alice, 1}], F). +prefs_disabled_set_request(Config) -> + F = fun(Alice) -> + escalus:send(Alice, stanza_prefs_set_request(<<"roster">>, + [<<"romeo@montague.net">>], + [<<"montague@montague.net">>], + mam_ns_binary())), + escalus:assert(is_error, [<<"cancel">>, <<"feature-not-implemented">>], + escalus:wait_for_stanza(Alice)), + assert_event_with_jid(mod_mam_pm_set_prefs, escalus_utils:get_short_jid(Alice)) + end, + escalus:fresh_story(Config, [{alice, 1}], F). + query_get_request(Config) -> F = fun(Alice) -> QueryXmlns = mam_ns_binary_v04(), From 14b13b2d44ac7f051c0c202ad329014d33df68c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Fri, 15 Nov 2024 10:04:36 +0100 Subject: [PATCH 2/2] Fix event name in mam_SUITE --- big_tests/tests/mam_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/big_tests/tests/mam_SUITE.erl b/big_tests/tests/mam_SUITE.erl index dbea55c9dab..1e940df432d 100644 --- a/big_tests/tests/mam_SUITE.erl +++ b/big_tests/tests/mam_SUITE.erl @@ -3666,7 +3666,7 @@ muc_prefs_set_request_not_an_owner(ConfigIn) -> [<<"montague@montague.net">>], mam_ns_binary()), Room)), escalus:assert(is_error, [<<"cancel">>, <<"not-allowed">>], escalus:wait_for_stanza(Bob)), - assert_no_event_with_jid(mod_mam_muc_get_prefs, RoomAddr) + assert_no_event_with_jid(mod_mam_muc_set_prefs, RoomAddr) end, RoomOpts = [{persistent, true}], UserSpecs = [{alice, 1}, {bob, 1}],