Skip to content

Commit

Permalink
Remove leftovers of the legacy CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekwegr committed Nov 14, 2023
1 parent a416630 commit 5b5b11a
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 57 deletions.
1 change: 0 additions & 1 deletion big_tests/default.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down
2 changes: 0 additions & 2 deletions big_tests/dynamic_domains.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
11 changes: 7 additions & 4 deletions big_tests/tests/gdpr_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ all() ->
].

groups() ->
%% **DON'T** make any of these groups parallel, because calling mongooseimctl
%% in parallel is broken!
[
{retrieve_personal_data, [], [
retrieve_vcard,
Expand Down Expand Up @@ -174,7 +176,7 @@ init_per_suite(Config) ->
#{node := MimNode} = distributed_helper:mim(),
Config1 = [{{ejabberd_cwd, MimNode}, get_mim_cwd()} | dynamic_modules:save_modules(host_type(), Config)],
muc_helper:load_muc(),
Config2 = graphql_helper:init_admin_handler(Config1),
Config2 = graphql_helper:init_admin_cli(Config1),
escalus:init_per_suite(Config2).

end_per_suite(Config) ->
Expand Down Expand Up @@ -1521,14 +1523,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")
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/metrics_roster_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ init_per_suite(Config) ->
[{mongoose_metrics, MongooseMetrics} | escalus:init_per_suite(Config)].

end_per_suite(Config) ->
escalus_fresh:clean(),
escalus:end_per_suite(Config).

init_per_group(_GroupName, Config) ->
Expand Down
5 changes: 4 additions & 1 deletion src/mod_roster.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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").
Expand Down
5 changes: 5 additions & 0 deletions src/mongoose_account_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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()}.

Expand Down
17 changes: 1 addition & 16 deletions src/mongoose_bin.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
%% ---------------------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions test/auth_tokens_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand All @@ -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;

Expand Down Expand Up @@ -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}},
Expand Down
8 changes: 1 addition & 7 deletions test/common/config_parser_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 1 addition & 11 deletions test/config_parser_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
].

Expand Down Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions test/ejabberd_sm_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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.
6 changes: 1 addition & 5 deletions test/mongoose_cleanup_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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].

Expand Down Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions tools/pkg/scripts/smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ fi

echo "Stopping mongooseim via 'mongooseimctl stop'"
mongooseimctl stop

0 comments on commit 5b5b11a

Please sign in to comment.