From fcb3d764ca455660147de04c1539e70530a413ca Mon Sep 17 00:00:00 2001 From: jacekwegr Date: Mon, 13 Nov 2023 20:18:05 +0100 Subject: [PATCH] Remove leftovers of the legacy CLI --- big_tests/default.spec | 1 - big_tests/dynamic_domains.spec | 2 -- big_tests/tests/gdpr_SUITE.erl | 7 ++++--- src/mod_roster.erl | 5 ++++- src/mongoose_account_api.erl | 5 +++++ src/mongoose_bin.erl | 17 +---------------- test/auth_tokens_SUITE.erl | 6 ------ test/common/config_parser_helper.erl | 8 +------- test/config_parser_SUITE.erl | 12 +----------- test/ejabberd_sm_SUITE.erl | 4 ---- test/mongoose_cleanup_SUITE.erl | 6 +----- tools/pkg/scripts/smoke_test.sh | 1 + 12 files changed, 18 insertions(+), 56 deletions(-) diff --git a/big_tests/default.spec b/big_tests/default.spec index 1c91e67e31c..708fd0ccb3b 100644 --- a/big_tests/default.spec +++ b/big_tests/default.spec @@ -75,7 +75,6 @@ {suites, "tests", mod_version_SUITE}. {suites, "tests", mongoose_cassandra_SUITE}. {suites, "tests", mongoose_elasticsearch_SUITE}. -{suites, "tests", mongooseimctl_SUITE}. {suites, "tests", muc_SUITE}. {suites, "tests", muc_http_api_SUITE}. {suites, "tests", muc_light_SUITE}. diff --git a/big_tests/dynamic_domains.spec b/big_tests/dynamic_domains.spec index 927e90cee37..dcfcbb3cb20 100644 --- a/big_tests/dynamic_domains.spec +++ b/big_tests/dynamic_domains.spec @@ -101,8 +101,6 @@ {suites, "tests", mod_version_SUITE}. -{suites, "tests", mongooseimctl_SUITE}. - {suites, "tests", muc_SUITE}. {skip_groups, "tests", muc_SUITE, [register_over_s2s], diff --git a/big_tests/tests/gdpr_SUITE.erl b/big_tests/tests/gdpr_SUITE.erl index 3cd8509b6dc..24b70e2ef31 100644 --- a/big_tests/tests/gdpr_SUITE.erl +++ b/big_tests/tests/gdpr_SUITE.erl @@ -1521,14 +1521,15 @@ retrieve_inbox_for_multiple_messages(Config) -> retrieve_logs(Config) -> escalus:fresh_story(Config, [{alice, 1}], fun(Alice) -> - User = escalus_client:username(Alice), - Domain = escalus_client:server(Alice), + User = string:to_lower(binary_to_list(escalus_client:username(Alice))), + Domain = string:to_lower(binary_to_list(escalus_client:server(Alice))), JID = string:to_upper(binary_to_list(escalus_client:short_jid(Alice))), #{node := MIM2NodeName} = MIM2Node = distributed_helper:mim2(), mongoose_helper:successful_rpc(net_kernel, connect_node, [MIM2NodeName]), mongoose_helper:successful_rpc(MIM2Node, error_logger, error_msg, ["event=disturbance_in_the_force, jid=~s", [JID]]), - Dir = request_and_unzip_personal_data(User, Domain, Config), + Dir = request_and_unzip_personal_data(list_to_binary(User), list_to_binary(Domain), + Config), Filename = filename:join(Dir, "logs-" ++ atom_to_list(MIM2NodeName) ++ ".txt"), {ok, Content} = file:read_file(Filename), {match, _} = re:run(Content, "disturbance_in_the_force") diff --git a/src/mod_roster.erl b/src/mod_roster.erl index 8fb34453013..15a46c41f8e 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -77,7 +77,10 @@ -ignore_xref([get_user_rosters_length/2, item_to_xml/1, process_subscription_t/6, - transaction/2]). + transaction/2, + broadcast_item/3, + set_items/3 + ]). -include("mongoose.hrl"). -include("jlib.hrl"). diff --git a/src/mongoose_account_api.erl b/src/mongoose_account_api.erl index ec36e2df17f..be1cbfd139f 100644 --- a/src/mongoose_account_api.erl +++ b/src/mongoose_account_api.erl @@ -19,6 +19,11 @@ check_password_hash/4, import_users/1]). +-ignore_xref([ban_account/3, + check_account/2, + check_password/3, + check_password_hash/4]). + -type register_result() :: {ok | exists | invalid_jid | cannot_register | limit_per_domain_exceeded, iolist()}. diff --git a/src/mongoose_bin.erl b/src/mongoose_bin.erl index db832e55659..984d1f0713b 100644 --- a/src/mongoose_bin.erl +++ b/src/mongoose_bin.erl @@ -12,8 +12,7 @@ join/2, encode_crypto/1, gen_from_crypto/0, - gen_from_timestamp/0, - string_to_binary/1]). + gen_from_timestamp/0]). %% --------------------------------------------------- %% API @@ -47,20 +46,6 @@ gen_from_timestamp() -> -spec encode_crypto(iodata()) -> binary(). encode_crypto(Text) -> base16:encode(crypto:hash(sha, Text)). --spec string_to_binary(binary() | list()) -> binary(). -string_to_binary(S) when is_list(S) -> - % If list is in Erlang representation of Unicode, we must use `unicode` module - % If it's not or is already converted, we must use list_to_binary - % since input can be from `file:consult/1` and prior to 17.0 - % this function returned bytes in a list instead of proper unicode string - % so it is already like after a call to `unicode`. - case lists:any(fun(C) -> C > 255 end, S) of - true -> unicode:characters_to_binary(S); - false -> list_to_binary(S) - end; -string_to_binary(B) when is_binary(B) -> - B. - %% --------------------------------------------------- %% Internal functions %% --------------------------------------------------- diff --git a/test/auth_tokens_SUITE.erl b/test/auth_tokens_SUITE.erl index 15c0d03af61..98ba07a62aa 100644 --- a/test/auth_tokens_SUITE.erl +++ b/test/auth_tokens_SUITE.erl @@ -65,7 +65,6 @@ init_per_testcase(validity_period_test, Config) -> mock_rdbms_backend(), mock_mongoose_metrics(), mock_gen_iq_handler(), - mock_ejabberd_commands(), async_helper:start(Config, [{mongooseim_helper, start_link_loaded_hooks, []}]); init_per_testcase(revoked_token_is_not_valid, Config) -> @@ -91,7 +90,6 @@ end_per_testcase(validity_period_test, C) -> meck:unload(mod_auth_token_backend), meck:unload(mongoose_metrics), meck:unload(gen_iq_handler), - meck:unload(ejabberd_commands), async_helper:stop_all(C), C; @@ -254,10 +252,6 @@ mock_tested_backend() -> receive {valid_seq_no, SeqNo} -> SeqNo end end). -mock_ejabberd_commands() -> - meck:new(ejabberd_commands, []), - meck:expect(ejabberd_commands, register_commands, fun (_) -> ok end). - provision_token_example() -> {token,provision, {{2055,10,27},{10,54,22}}, diff --git a/test/common/config_parser_helper.erl b/test/common/config_parser_helper.erl index c585018de78..f683bce57c8 100644 --- a/test/common/config_parser_helper.erl +++ b/test/common/config_parser_helper.erl @@ -260,10 +260,7 @@ options("mongooseim-pgsql") -> {registration_timeout, infinity}, {routing_modules, mongoose_router:default_routing_modules()}, {services, - #{service_admin_extra => - #{submods => [node, accounts, sessions, vcard, gdpr, upload, - roster, last, private, stanza, stats]}, - service_mongoose_system_metrics => + #{service_mongoose_system_metrics => #{initial_report => 300000, periodic_report => 10800000}}}, {sm_backend, mnesia}, @@ -1258,9 +1255,6 @@ default_config([outgoing_pools, _Type, _Tag, conn_opts, tls] = P) -> server_name_indication => default_config(P ++ [server_name_indication])}; default_config([outgoing_pools, _Type, _Tag, conn_opts, tls, server_name_indication]) -> #{enabled => true, protocol => default}; -default_config([services, service_admin_extra]) -> - #{submods => [node, accounts, sessions, vcard, roster, last, - private, stanza, stats, gdpr, upload, domain]}; default_config([services, service_domain_db]) -> #{event_cleaning_interval => 1800, event_max_age => 7200, diff --git a/test/config_parser_SUITE.erl b/test/config_parser_SUITE.erl index 9b6935c543f..aedfba12dd0 100644 --- a/test/config_parser_SUITE.erl +++ b/test/config_parser_SUITE.erl @@ -230,8 +230,7 @@ groups() -> mod_version, modules_without_config, incorrect_module]}, - {services, [parallel], [service_admin_extra, - service_domain_db, + {services, [parallel], [service_domain_db, service_mongoose_system_metrics]} ]. @@ -2857,15 +2856,6 @@ incorrect_module(_Config) -> %% Services -service_admin_extra(_Config) -> - P = [services, service_admin_extra], - T = fun(Opts) -> #{<<"services">> => #{<<"service_admin_extra">> => Opts}} end, - ?cfg(P, default_config(P), T(#{})), - ?cfg(P ++ [submods], [node], T(#{<<"submods">> => [<<"node">>]})), - ?err(T(#{<<"submods">> => 1})), - ?err(T(#{<<"submods">> => [1]})), - ?err(T(#{<<"submods">> => [<<"nodejshaha">>]})). - service_domain_db(_Config) -> P = [services, service_domain_db], T = fun(Opts) -> #{<<"services">> => #{<<"service_domain_db">> => Opts}} end, diff --git a/test/ejabberd_sm_SUITE.erl b/test/ejabberd_sm_SUITE.erl index 38d4a72caf4..f8f38866074 100644 --- a/test/ejabberd_sm_SUITE.erl +++ b/test/ejabberd_sm_SUITE.erl @@ -400,7 +400,6 @@ unique_count_while_removing_entries(C) -> unload_meck() -> meck:unload(acl), meck:unload(gen_hook), - meck:unload(ejabberd_commands), meck:unload(mongoose_domain_api), catch ets:delete(test_c2s_info), catch meck:unload(mongoose_c2s). @@ -647,7 +646,4 @@ sm_backend(ejabberd_sm_cets) -> cets. set_meck() -> meck:expect(gen_hook, add_handler, fun(_, _, _, _, _) -> ok end), meck:expect(gen_hook, add_handlers, fun(_) -> ok end), - meck:new(ejabberd_commands, []), - meck:expect(ejabberd_commands, register_commands, fun(_) -> ok end), - meck:expect(ejabberd_commands, unregister_commands, fun(_) -> ok end), ok. diff --git a/test/mongoose_cleanup_SUITE.erl b/test/mongoose_cleanup_SUITE.erl index f41a3e83548..72822d01a1f 100644 --- a/test/mongoose_cleanup_SUITE.erl +++ b/test/mongoose_cleanup_SUITE.erl @@ -125,7 +125,7 @@ opts() -> {modules, ?HOST} => #{}}. meck_mods(bosh) -> [exometer, mod_bosh_socket]; -meck_mods(s2s) -> [exometer, ejabberd_commands, mongoose_bin]; +meck_mods(s2s) -> [exometer, mongoose_bin]; meck_mods(component) -> [exometer]; meck_mods(_) -> [exometer, ejabberd_sm, ejabberd_local]. @@ -298,10 +298,6 @@ setup_meck([ejabberd_local | R]) -> meck:expect(ejabberd_local, register_iq_handler, fun(_A1, _A2, _A3) -> ok end), setup_meck(R); -setup_meck([ejabberd_commands | R]) -> - meck:new(ejabberd_commands), - meck:expect(ejabberd_commands, register_commands, fun(_) -> ok end), - setup_meck(R); setup_meck([mongoose_bin | R]) -> meck:new(mongoose_bin, [passthrough]), meck:expect(mongoose_bin, gen_from_crypto, fun() -> <<"123456">> end), diff --git a/tools/pkg/scripts/smoke_test.sh b/tools/pkg/scripts/smoke_test.sh index 6fb1c6b5e8a..fba996dc022 100755 --- a/tools/pkg/scripts/smoke_test.sh +++ b/tools/pkg/scripts/smoke_test.sh @@ -83,3 +83,4 @@ fi echo "Stopping mongooseim via 'mongooseimctl stop'" mongooseimctl stop +