diff --git a/big_tests/tests/accounts_SUITE.erl b/big_tests/tests/accounts_SUITE.erl index f13695f2fab..6cf83d24ce4 100644 --- a/big_tests/tests/accounts_SUITE.erl +++ b/big_tests/tests/accounts_SUITE.erl @@ -91,8 +91,8 @@ init_per_group(bad_cancelation, Config) -> init_per_group(change_account_details, Config) -> [{escalus_user_db, {module, escalus_ejabberd}} |Config]; init_per_group(change_account_details_store_plain, Config) -> - Config1 = mongoose_helper:backup_auth_config(Config), - mongoose_helper:set_store_password(plain), + AuthOpts = mongoose_helper:auth_opts_with_password_format(plain), + Config1 = mongoose_helper:backup_and_set_config_option(Config, auth_opts, AuthOpts), [{escalus_user_db, {module, escalus_ejabberd}} |Config1]; init_per_group(registration_timeout, Config) -> set_registration_timeout(Config); @@ -102,8 +102,7 @@ init_per_group(users_number_estimate, Config) -> AuthOpts = get_auth_opts(), Key = rdbms_users_number_estimate, NewAuthOpts = lists:keystore(Key, 1, AuthOpts, {Key, true}), - set_auth_opts(NewAuthOpts), - [{auth_opts, AuthOpts} | Config]; + set_auth_opts(Config, NewAuthOpts); init_per_group(_GroupName, Config) -> Config. @@ -112,7 +111,7 @@ end_per_group(change_account_details, Config) -> [{escalus_user_db, xmpp} | Config]; end_per_group(change_account_details_store_plain, Config) -> escalus_fresh:clean(), - mongoose_helper:restore_auth_config(Config), + mongoose_helper:restore_config(Config), [{escalus_user_db, xmpp} | Config]; end_per_group(bad_cancelation, Config) -> escalus:delete_users(Config, escalus:get_users([alice])); @@ -121,18 +120,19 @@ end_per_group(registration_timeout, Config) -> end_per_group(utilities, Config) -> escalus:delete_users(Config, escalus:get_users([alice, bob])); end_per_group(users_number_estimate, Config) -> - StoredAuthOpts = ?config(auth_opts, Config), - set_auth_opts(StoredAuthOpts); + mongoose_helper:restore_config(Config); end_per_group(_GroupName, Config) -> Config. get_auth_opts() -> - rpc(mim(), ejabberd_config, get_local_option, [{auth_opts, host_type()}]). + rpc(mim(), mongoose_config, get_opt, [{auth_opts, host_type()}]). -set_auth_opts(AuthOpts) -> +set_auth_opts(Config, AuthOpts) -> rpc(mim(), ejabberd_auth, stop, [host_type()]), - rpc(mim(), ejabberd_config, add_local_option, [{auth_opts, host_type()}, AuthOpts]), - rpc(mim(), ejabberd_auth, start, [host_type()]). + Config1 = mongoose_helper:backup_and_set_config_option(Config, {auth_opts, host_type()}, + AuthOpts), + rpc(mim(), ejabberd_auth, start, [host_type()]), + Config1. init_per_testcase(admin_notify, Config) -> [{_, AdminSpec}] = escalus_users:get_users([admin]), @@ -145,8 +145,8 @@ init_per_testcase(not_allowed_registration_cancelation, Config) -> reload_mod_register_option(Config, access, {access, none}), escalus:init_per_testcase(not_allowed_registration_cancelation, Config); init_per_testcase(registration_failure_timeout, Config) -> - ok = deny_everyone_registration(), - escalus:init_per_testcase(registration_failure_timeout, Config); + Config1 = deny_everyone_registration(Config), + escalus:init_per_testcase(registration_failure_timeout, Config1); init_per_testcase(CaseName, Config) when CaseName =:= list_selected_users; CaseName =:= count_selected_users -> case mongoose_helper:auth_modules() of @@ -175,7 +175,7 @@ end_per_testcase(registration_timeout, Config) -> escalus:delete_users(Config, escalus:get_users([alice, bob])), escalus:end_per_testcase(registration_timeout, Config); end_per_testcase(registration_failure_timeout, Config) -> - ok = allow_everyone_registration(), + mongoose_helper:restore_config_option(Config, {access, register, global}), escalus:end_per_testcase(registration_failure_timeout, Config); end_per_testcase(CaseName, Config) -> escalus:end_per_testcase(CaseName, Config). @@ -405,28 +405,14 @@ strong_pwd() -> <<"Sup3r","c4li","fr4g1","l1571c","3xp1","4l1","d0c10u5">>. set_registration_timeout(Config) -> - Record = {local_config, registration_timeout, ?REGISTRATION_TIMEOUT}, - OldTimeout = rpc(mim(), ejabberd_config, get_local_option, [registration_timeout]), - true = rpc(mim(), ets, insert, [local_config, Record]), - [ {old_timeout, OldTimeout} | Config ]. + mongoose_helper:backup_and_set_config_option(Config, registration_timeout, + ?REGISTRATION_TIMEOUT). restore_registration_timeout(Config) -> - {old_timeout, OldTimeout} = proplists:lookup(old_timeout, Config), - Record = {local_config, registration_timeout, OldTimeout}, - true = rpc(mim(), ets, insert, [local_config, Record]), - proplists:delete(old_timeout, Config). - -deny_everyone_registration() -> - ok = change_registration_settings_for_everyone(deny). - -allow_everyone_registration() -> - ok = change_registration_settings_for_everyone(allow). - -change_registration_settings_for_everyone(Rule) - when allow =:= Rule; deny =:= Rule -> - {atomic,ok} = rpc(mim(), ejabberd_config, add_local_option, - [{access, register, global}, [{Rule, all}]]), - ok. + mongoose_helper:restore_config_option(Config, registration_timeout). + +deny_everyone_registration(Config) -> + mongoose_helper:backup_and_set_config_option(Config, {access, register, global}, [{deny, all}]). has_registered_element(Stanza) -> [#xmlel{name = <<"registered">>}] =:= exml_query:paths(Stanza, diff --git a/big_tests/tests/connect_SUITE.erl b/big_tests/tests/connect_SUITE.erl index 6484a510905..a3b8b6d070d 100644 --- a/big_tests/tests/connect_SUITE.erl +++ b/big_tests/tests/connect_SUITE.erl @@ -185,26 +185,18 @@ end_per_group(_, Config) -> Config. init_per_testcase(close_connection_if_service_type_is_hidden = CN, Config) -> - OptName = hide_service_name, - mongoose_helper:successful_rpc(ejabberd_config, add_local_option, [OptName, true]), - escalus:init_per_testcase(CN, Config); + Config1 = mongoose_helper:backup_and_set_config_option(Config, hide_service_name, true), + escalus:init_per_testcase(CN, Config1); init_per_testcase(replaced_session_cannot_terminate = CN, Config) -> S = escalus_users:get_server(Config, alice), OptKey = {replaced_wait_timeout, S}, - {atomic, _} = rpc(mim(), ejabberd_config, add_local_option, [OptKey, 1]), - escalus:init_per_testcase(CN, [{opt_to_del, OptKey} | Config]); + Config1 = mongoose_helper:backup_and_set_config_option(Config, OptKey, 1), + escalus:init_per_testcase(CN, Config1); init_per_testcase(CaseName, Config) -> escalus:init_per_testcase(CaseName, Config). -end_per_testcase(close_connection_if_service_type_is_hidden = CN, Config) -> - OptName = hide_service_name, - mongoose_helper:successful_rpc(ejabberd_config, del_local_option, [OptName]), - escalus:end_per_testcase(CN, Config); -end_per_testcase(replaced_session_cannot_terminate = CN, Config) -> - {_, OptKey} = lists:keyfind(opt_to_del, 1, Config), - {atomic, _} = rpc(mim(), ejabberd_config, del_local_option, [OptKey]), - escalus:end_per_testcase(CN, Config); end_per_testcase(CaseName, Config) -> + mongoose_helper:restore_config(Config), escalus:end_per_testcase(CaseName, Config). %%-------------------------------------------------------------------- diff --git a/big_tests/tests/login_SUITE.erl b/big_tests/tests/login_SUITE.erl index 699141fe2dc..e7af1e4822d 100644 --- a/big_tests/tests/login_SUITE.erl +++ b/big_tests/tests/login_SUITE.erl @@ -113,70 +113,82 @@ suite() -> %%-------------------------------------------------------------------- init_per_suite(Config) -> - Config0 = mongoose_helper:backup_auth_config(Config), - Config1 = mongoose_helper:backup_sasl_mechanisms_config(Config0), - mongoose_helper:set_store_password(scram), - escalus:init_per_suite(Config1). + escalus:init_per_suite(Config). end_per_suite(Config) -> escalus_fresh:clean(), - mongoose_helper:restore_auth_config(Config), - mongoose_helper:restore_sasl_mechanisms_config(Config), escalus:end_per_suite(Config). -init_per_group(login_digest, ConfigIn) -> - Config = mongoose_helper:backup_sasl_mechanisms_config(ConfigIn), - mongoose_helper:set_store_password(plain), +init_per_group(login_digest = GroupName, ConfigIn) -> + Config = backup_and_set_options(GroupName, ConfigIn), case mongoose_helper:supports_sasl_module(cyrsasl_digest) of false -> - mongoose_helper:set_store_password(scram), + mongoose_helper:restore_config(Config), {skip, "digest password type not supported"}; true -> - Config1 = configure_digest(Config), - escalus:create_users(Config1, escalus:get_users([alice, bob])) + escalus:create_users(Config, escalus:get_users([alice, bob])) end; -init_per_group(GroupName, Config) when - GroupName == login_scram; GroupName == login_scram_store_plain -> +init_per_group(GroupName, ConfigIn) + when GroupName == login_scram; + GroupName == login_scram_store_plain -> + Config = backup_and_set_options(GroupName, ConfigIn), case are_sasl_scram_modules_supported() of false -> + mongoose_helper:restore_config(Config), {skip, "scram password type not supported"}; true -> - config_password_format(GroupName), Config2 = escalus:create_users(Config, escalus:get_users([alice, bob, neustradamus])), assert_password_format(GroupName, Config2) end; -init_per_group(login_scram_tls, Config) -> +init_per_group(login_scram_tls = GroupName, ConfigIn) -> + Config = backup_and_set_options(GroupName, ConfigIn), case are_sasl_scram_modules_supported() of false -> + mongoose_helper:restore_config(Config), {skip, "scram password type not supported"}; true -> Config1 = config_ejabberd_node_tls(Config), - config_password_format(login_scram_tls), Config2 = create_tls_users(Config1), assert_password_format(scram, Config2) end; -init_per_group(login_specific_scram, Config) -> +init_per_group(login_specific_scram = GroupName, ConfigIn) -> + Config = backup_and_set_options(GroupName, ConfigIn), case are_sasl_scram_modules_supported() of false -> + mongoose_helper:restore_config(Config), {skip, "scram password type not supported"}; true -> escalus:create_users(Config, escalus:get_users([alice, bob, neustradamus])) end; -init_per_group(_GroupName, Config) -> +init_per_group(GroupName, ConfigIn) -> + Config = backup_and_set_options(GroupName, ConfigIn), escalus:create_users(Config, escalus:get_users([alice, bob])). +backup_and_set_options(GroupName, Config) -> + Options = config_options(GroupName), + mongoose_helper:backup_and_set_config(Config, Options). + +config_options(login_digest) -> + #{{auth_opts, host_type()} => mongoose_helper:auth_opts_with_password_format(plain), + {sasl_mechanisms, host_type()} => [cyrsasl_digest]}; +config_options(login_scram_store_plain) -> + #{{auth_opts, host_type()} => mongoose_helper:auth_opts_with_password_format(plain)}; +config_options(_GroupName) -> + #{{auth_opts, host_type()} => mongoose_helper:auth_opts_with_password_format(scram)}. + end_per_group(login_digest, Config) -> - mongoose_helper:set_store_password(scram), - mongoose_helper:restore_sasl_mechanisms_config(Config), + mongoose_helper:restore_config(Config), escalus:delete_users(Config, escalus:get_users([alice, bob])); end_per_group(GroupName, Config) when GroupName == login_scram; GroupName == login_specific_scram -> - mongoose_helper:set_store_password(scram), + mongoose_helper:restore_config(Config), escalus:delete_users(Config, escalus:get_users([alice, bob, neustradamus])); end_per_group(login_scram_tls, Config) -> + mongoose_helper:restore_config(Config), restore_c2s(Config), delete_tls_users(Config); end_per_group(_GroupName, Config) -> + mongoose_helper:restore_config(Config), escalus:delete_users(Config, escalus:get_users([alice, bob])). init_per_testcase(CaseName, Config) when @@ -189,7 +201,7 @@ init_per_testcase(CaseName, Config) when end; init_per_testcase(message_zlib_limit, Config) -> Listeners = [Listener - || {Listener, _, _} <- rpc(mim(), ejabberd_config, get_local_option, [listen])], + || {Listener, _, _} <- rpc(mim(), mongoose_config, get_opt, [listen])], [{_U, Props}] = escalus_users:get_users([hacker]), Port = proplists:get_value(port, Props), case lists:keymember(Port, 1, Listeners) of @@ -346,9 +358,9 @@ log_non_existent(Config) -> {error, {connection_step_failed, _, R}} = escalus_client:start(Config, UserSpec, <<"res">>), R. -blocked_user(_Config) -> +blocked_user(Config) -> [{_, Spec}] = escalus_users:get_users([alice]), - set_acl_for_blocking(Spec), + Config1 = set_acl_for_blocking(Config, Spec), try {ok, _Alice, _Spec2, _Features} = escalus_connection:start(Spec), ct:fail("Alice authenticated but shouldn't") @@ -356,7 +368,7 @@ blocked_user(_Config) -> error:{assertion_failed, assert, is_iq_result, Stanza, _Bin} -> <<"cancel">> = exml_query:path(Stanza, [{element, <<"error">>}, {attr, <<"type">>}]) after - unset_acl_for_blocking() + unset_acl_for_blocking(Config1) end, ok. @@ -398,11 +410,6 @@ config_ejabberd_node_tls(Config) -> mongoose_helper:restart_listener_with_opts(mim(), C2SListener, NewOpts), [{c2s_listener, C2SListener} | Config]. -configure_digest(Config) -> - mongoose_helper:set_sasl_mechanisms(sasl_mechanisms, [cyrsasl_digest]), - mongoose_helper:set_store_password(plain), - Config. - create_tls_users(Config) -> Config1 = escalus:create_users(Config, escalus:get_users([alice, neustradamus])), Users = proplists:get_value(escalus_users, Config1, []), @@ -417,11 +424,6 @@ create_tls_users(Config) -> delete_tls_users(Config) -> escalus:delete_users(Config, escalus:get_users([alice, neustradamus])). -config_password_format(GN) when GN == login_scram; GN == login_scram_tls -> - mongoose_helper:set_store_password(scram); -config_password_format(_) -> - mongoose_helper:set_store_password(plain). - assert_password_format(GroupName, Config) -> Users = proplists:get_value(escalus_users, Config), [verify_format(GroupName, User) || User <- Users], @@ -452,34 +454,36 @@ do_verify_format(login_scram, _Password, SPassword) -> do_verify_format(_, Password, SPassword) -> Password = SPassword. -set_acl_for_blocking(Spec) -> +set_acl_for_blocking(Config, Spec) -> User = proplists:get_value(username, Spec), LUser = jid:nodeprep(User), - rpc(mim(), ejabberd_config, add_local_option, [{acl, blocked, host_type()}, [{user, LUser}]]). + mongoose_helper:backup_and_set_config_option(Config, {acl, blocked, host_type()}, + [{user, LUser}]). -unset_acl_for_blocking() -> - rpc(mim(), ejabberd_config, del_local_option, [{acl, blocked, host_type()}]). +unset_acl_for_blocking(Config) -> + mongoose_helper:restore_config_option(Config, {acl, blocked, host_type()}). configure_and_log_scram(Config, Sha, Mech) -> - mongoose_helper:set_store_password({scram, [Sha]}), - assert_password_format({scram, Sha}, Config), + set_scram_sha(Config, Sha), log_one([{escalus_auth_method, Mech} | Config]). configure_and_log_scram_plus(Config, Sha, Mech) -> - mongoose_helper:set_store_password({scram, [Sha]}), - assert_password_format({scram, Sha}, Config), + set_scram_sha(Config, Sha), log_one_scram_plus([{escalus_auth_method, Mech} | Config]). configure_and_fail_log_scram(Config, Sha, Mech) -> - mongoose_helper:set_store_password({scram, [Sha]}), - assert_password_format({scram, Sha}, Config), + set_scram_sha(Config, Sha), {expected_challenge, _, _} = fail_log_one([{escalus_auth_method, Mech} | Config]). configure_scram_plus_and_fail_log_scram(Config, Sha, Mech) -> - mongoose_helper:set_store_password({scram, [Sha]}), - assert_password_format({scram, Sha}, Config), + set_scram_sha(Config, Sha), {expected_challenge, _, _} = fail_log_one_scram_plus([{escalus_auth_method, Mech} | Config]). +set_scram_sha(Config, Sha) -> + NewAuthOpts = mongoose_helper:auth_opts_with_password_format({scram, [Sha]}), + mongoose_helper:change_config_option(Config, {auth_opts, host_type()}, NewAuthOpts), + assert_password_format({scram, Sha}, Config). + fail_log_one(Config) -> [{alice, UserSpec}] = escalus_users:get_users([alice]), {error, {connection_step_failed, _, R}} = escalus_client:start(Config, UserSpec, <<"res">>), diff --git a/big_tests/tests/mam_SUITE.erl b/big_tests/tests/mam_SUITE.erl index 5bf5d78c9c1..f41f1c60959 100644 --- a/big_tests/tests/mam_SUITE.erl +++ b/big_tests/tests/mam_SUITE.erl @@ -521,9 +521,9 @@ suite() -> init_per_suite(Config) -> muc_helper:load_muc(), - disable_sessions_limit(disable_shaping( + increase_limits( delete_users([{escalus_user_db, {module, escalus_ejabberd}} - | escalus:init_per_suite(Config)]))). + | escalus:init_per_suite(Config)])). end_per_suite(Config) -> muc_helper:unload_muc(), @@ -532,7 +532,8 @@ end_per_suite(Config) -> %% and this function kicks them without waiting... mongoose_helper:kick_everyone(), %% so we don't have sessions anymore and other tests will not fail - escalus:end_per_suite(restore_sessions_limit(restore_shaping(Config))). + mongoose_helper:restore_config(Config), + escalus:end_per_suite(Config). user_names() -> [alice, bob, kate, carol]. @@ -543,44 +544,16 @@ create_users(Config) -> delete_users(Config) -> escalus:delete_users(Config, escalus:get_users(user_names())). -disable_shaping(Config) -> - OldShaper = get_shaper(), - set_shaper({{maxrate, 10000}, {maxrate, 10000000}, {maxrate, 10000000}}), - [{old_mam_shaper, OldShaper}|Config]. +increase_limits(Config) -> + Config1 = mongoose_helper:backup_and_set_config(Config, increased_limits()), + rpc_apply(shaper_srv, reset_all_shapers, [host_type()]), + Config1. -restore_shaping(Config) -> - OldShaper = proplists:get_value(old_mam_shaper, Config), - set_shaper(OldShaper), - Config. - -get_shaper() -> - Mam = rpc_apply(ejabberd_config, get_local_option, [{shaper, mam_shaper, global}]), - Norm = rpc_apply(ejabberd_config, get_local_option, [{shaper, normal, global}]), - Fast = rpc_apply(ejabberd_config, get_local_option, [{shaper, fast, global}]), - {Mam, Norm, Fast}. - -set_shaper({Mam, Norm, Fast}) -> - rpc_apply(ejabberd_config, add_local_option, [{shaper, mam_shaper, global}, Mam]), - rpc_apply(ejabberd_config, add_local_option, [{shaper, normal, global}, Norm]), - rpc_apply(ejabberd_config, add_local_option, [{shaper, fast, global}, Fast]), - rpc_apply(shaper_srv, reset_all_shapers, [host_type()]). - -disable_sessions_limit(Config) -> - OldLimit = get_sessions_limit(), - set_sessions_limit([{10000, all}]), - [{old_sessions_limit, OldLimit}|Config]. - -restore_sessions_limit(Config) -> - OldLimit = proplists:get_value(old_sessions_limit, Config), - set_sessions_limit(OldLimit), - Config. - -get_sessions_limit() -> - rpc_apply(ejabberd_config, get_local_option, [{access, max_user_sessions, global}]). - -set_sessions_limit(NewLimit) -> - rpc_apply(ejabberd_config, add_local_option, - [{access, max_user_sessions, global}, NewLimit]). +increased_limits() -> + #{{shaper, mam_shaper, global} => {maxrate, 10000}, + {shaper, normal, global} => {maxrate, 10000000}, + {shaper, fast, global} => {maxrate, 10000000}, + {access, max_user_sessions, global} => [{10000, all}]}. init_per_group(mam04, Config) -> [{props, mam04_props()}|Config]; diff --git a/big_tests/tests/metrics_register_SUITE.erl b/big_tests/tests/metrics_register_SUITE.erl index aba502d4341..2dbd948223b 100644 --- a/big_tests/tests/metrics_register_SUITE.erl +++ b/big_tests/tests/metrics_register_SUITE.erl @@ -67,10 +67,10 @@ init_per_testcase(unregister, Config) -> escalus_users:create_user(Config, Alice), Config; init_per_testcase(registered_users, Config) -> - case rpc(mim(), ejabberd_config, get_local_option, [{auth_method, host_type()}]) of - external -> + case rpc(mim(), mongoose_config, lookup_opt, [{auth_method, host_type()}]) of + {ok, external} -> {skip, "counter not supported with ejabberd_auth_external"}; - anonymous -> + {ok, anonymous} -> {skip, "counter not supported with anonymous authentication"}; _ -> Config diff --git a/big_tests/tests/mongooseimctl_SUITE.erl b/big_tests/tests/mongooseimctl_SUITE.erl index cebff250125..8030777614f 100644 --- a/big_tests/tests/mongooseimctl_SUITE.erl +++ b/big_tests/tests/mongooseimctl_SUITE.erl @@ -276,8 +276,8 @@ init_per_testcase(check_password_hash, Config) -> true -> {skip, not_fully_supported_with_ldap}; false -> - Config1 = mongoose_helper:backup_auth_config(Config), - mongoose_helper:set_store_password(plain), + AuthOpts = mongoose_helper:auth_opts_with_password_format(plain), + Config1 = mongoose_helper:backup_and_set_config_option(Config, auth_opts, AuthOpts), Config2 = escalus:create_users(Config1, escalus:get_users([carol])), escalus:init_per_testcase(check_password_hash, Config2) end; @@ -305,7 +305,7 @@ end_per_testcase(delete_old_users, Config) -> end, Users), escalus:end_per_testcase(delete_old_users, Config); end_per_testcase(check_password_hash, Config) -> - mongoose_helper:restore_auth_config(Config), + mongoose_helper:restore_config(Config), escalus:delete_users(Config, escalus:get_users([carol])); end_per_testcase(CaseName, Config) -> %% Because kick_session fails with unexpected stanza received: diff --git a/big_tests/tests/oauth_SUITE.erl b/big_tests/tests/oauth_SUITE.erl index edbe92942ba..33775937eeb 100644 --- a/big_tests/tests/oauth_SUITE.erl +++ b/big_tests/tests/oauth_SUITE.erl @@ -113,16 +113,20 @@ init_per_group(GroupName, Config0) -> commands -> ejabberd_node_utils:init(Config0); _ -> Config0 end, - Config1 = mongoose_helper:backup_auth_config(Config), - config_password_format(GroupName), + AuthOpts = mongoose_helper:auth_opts_with_password_format(password_format(GroupName)), + Config1 = mongoose_helper:backup_and_set_config_option(Config, auth_opts, AuthOpts), Config2 = escalus:create_users(Config1, escalus:get_users([bob, alice])), assert_password_format(GroupName, Config2). + +password_format(login_scram) -> scram; +password_format(_) -> plain. + end_per_group(cleanup, Config) -> - mongoose_helper:restore_auth_config(Config), + mongoose_helper:restore_config(Config), escalus:delete_users(Config, escalus:get_users([alice])); end_per_group(_GroupName, Config) -> - mongoose_helper:restore_auth_config(Config), + mongoose_helper:restore_config(Config), escalus:delete_users(Config, escalus:get_users([bob, alice])). init_per_testcase(check_for_oauth_with_mod_auth_token_not_loaded, Config) -> @@ -370,11 +374,6 @@ extract_tokens(#xmlel{name = <<"iq">>, children = [#xmlel{name = <<"items">>} = RTD = exml_query:path(Items, [{element, <<"refresh_token">>}, cdata]), {base64:decode(ATD), base64:decode(RTD)}. -config_password_format(login_scram) -> - monggose_helper:set_store_password(scram); -config_password_format(_) -> - mongoose_helper:set_store_password(plain). - assert_password_format(GroupName, Config) -> Users = proplists:get_value(escalus_users, Config), [verify_format(GroupName, User) || User <- Users], diff --git a/big_tests/tests/sasl_SUITE.erl b/big_tests/tests/sasl_SUITE.erl index 8a79bff52c3..db0a5668889 100644 --- a/big_tests/tests/sasl_SUITE.erl +++ b/big_tests/tests/sasl_SUITE.erl @@ -101,15 +101,10 @@ set_sasl_mechanisms(Key, Config) -> fun(_, M) -> M =:= ?MODULE end]), %% configure the mechanism - Mechs = rpc(mim(), ejabberd_config, get_local_option, [Key]), - rpc(mim(), ejabberd_config, add_local_option, [Key, [?MODULE]]), - [{mechs, Mechs} | Config]. + mongoose_helper:backup_and_set_config_option(Config, Key, [?MODULE]). reset_sasl_mechanisms(Key, Config) -> - case ?config(mechs, Config) of - undefined -> rpc(mim(), ejabberd_config, del_local_option, [Key]); - Mechs -> rpc(mim(), ejabberd_config, add_local_option, [Key, Mechs]) - end, + mongoose_helper:restore_config_option(Config, Key), rpc(mim(), meck, unload, [ejabberd_auth]). assert_is_failure_with_text(#xmlel{name = <<"failure">>, diff --git a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl index de4f5c3c597..94e78ac1dc4 100644 --- a/big_tests/tests/service_mongoose_system_metrics_SUITE.erl +++ b/big_tests/tests/service_mongoose_system_metrics_SUITE.erl @@ -236,7 +236,7 @@ system_metrics_are_reported_to_google_analytics_when_mim_starts(_Config) -> all_event_have_the_same_client_id(). tracking_id_is_correctly_configured(_Config) -> - TrackingId = distributed_helper:rpc(mim(), ejabberd_config, get_local_option, [google_analytics_tracking_id]), + TrackingId = distributed_helper:rpc(mim(), mongoose_config, get_opt, [google_analytics_tracking_id]), case os:getenv("CI") of "true" -> ?assertEqual(?TRACKING_ID_CI, TrackingId); @@ -395,7 +395,7 @@ enable_system_metrics(Node) -> enable_system_metrics(Node, Timers) -> UrlArgs = [google_analytics_url, ?SERVER_URL], - {atomic, ok} = mongoose_helper:successful_rpc(Node, ejabberd_config, add_local_option, UrlArgs), + ok = mongoose_helper:successful_rpc(Node, mongoose_config, set_opt, UrlArgs), start_system_metrics_module(Node, Timers). enable_system_metrics_with_configurable_tracking_id(Node) -> @@ -407,7 +407,7 @@ start_system_metrics_module(Node, Args) -> disable_system_metrics(Node) -> distributed_helper:rpc(Node, mongoose_service, stop_service, [service_mongoose_system_metrics]), - mongoose_helper:successful_rpc(Node, ejabberd_config, del_local_option, [ google_analytics_url ]). + mongoose_helper:successful_rpc(Node, mongoose_config, unset_opt, [ google_analytics_url ]). delete_prev_client_id(Node) -> mongoose_helper:successful_rpc(Node, mnesia, delete_table, [service_mongoose_system_metrics]). @@ -427,17 +427,16 @@ system_metrics_service_is_disabled(Node) -> configure_additional_tracking_id(Node) -> TrackingIdArgs = [extra_google_analytics_tracking_id, ?TRACKING_ID_EXTRA], - {atomic, ok} = mongoose_helper:successful_rpc(Node, ejabberd_config, add_local_option, TrackingIdArgs). + {atomic, ok} = mongoose_helper:successful_rpc(Node, mongoose_config, set_opt, TrackingIdArgs). remove_additional_tracking_id(Node) -> mongoose_helper:successful_rpc( - Node, ejabberd_config, del_local_option, [ extra_google_analytics_tracking_id ]). + Node, mongoose_config, unset_opt, [ extra_google_analytics_tracking_id ]). remove_service_from_config(Service) -> - Services = distributed_helper:rpc( - mim3(), ejabberd_config, get_local_option_or_default, [services, []]), - NewServices = proplists:delete(Service, Services), - distributed_helper:rpc(mim3(), ejabberd_config, add_local_option, [services, NewServices]). + Services = distributed_helper:rpc(mim3(), mongoose_config, get_opt, [services]), + NewServices = proplists:delete(Service, Services), + distributed_helper:rpc(mim3(), mongooose_config, set_opt, [services, NewServices]). events_are_reported_to_additional_tracking_id() -> Tab = ets:tab2list(?ETS_TABLE), diff --git a/big_tests/tests/shared_roster_SUITE.erl b/big_tests/tests/shared_roster_SUITE.erl index 2f38cdb9e72..a9f87daf496 100644 --- a/big_tests/tests/shared_roster_SUITE.erl +++ b/big_tests/tests/shared_roster_SUITE.erl @@ -165,7 +165,7 @@ stop_roster_module(_) -> get_auth_method() -> XMPPDomain = domain(), - case rpc(mim(), ejabberd_config, get_local_option, [{auth_method, XMPPDomain}]) of + case rpc(mim(), mongoose_config, get_opt, [{auth_method, XMPPDomain}]) of [Method|_] -> Method; _ ->