Skip to content

Commit

Permalink
Replace global config with local config in big tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrzaszcz committed Oct 14, 2021
1 parent ce7f288 commit 65849dc
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion big_tests/tests/accounts_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ allow_everyone_registration() ->

change_registration_settings_for_everyone(Rule)
when allow =:= Rule; deny =:= Rule ->
{atomic,ok} = rpc(mim(), ejabberd_config, add_global_option,
{atomic,ok} = rpc(mim(), ejabberd_config, add_local_option,
[{access, register, global}, [{Rule, all}]]),
ok.

Expand Down
5 changes: 2 additions & 3 deletions big_tests/tests/login_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,10 @@ do_verify_format(_, Password, SPassword) ->
set_acl_for_blocking(Spec) ->
User = proplists:get_value(username, Spec),
LUser = jid:nodeprep(User),
rpc(mim(), ejabberd_config, add_global_option, [{acl, blocked, host_type()}, [{user, LUser}]]).
rpc(mim(), ejabberd_config, add_local_option, [{acl, blocked, host_type()}, [{user, LUser}]]).

unset_acl_for_blocking() ->
%% There is no del_global_option
rpc(mim(), mnesia, dirty_delete, [config, {acl, blocked, host_type()}]).
rpc(mim(), ejabberd_config, del_local_option, [{acl, blocked, host_type()}]).

configure_and_log_scram(Config, Sha, Mech) ->
mongoose_helper:set_store_password({scram, [Sha]}),
Expand Down
16 changes: 8 additions & 8 deletions big_tests/tests/mam_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -554,15 +554,15 @@ restore_shaping(Config) ->
Config.

get_shaper() ->
Mam = rpc_apply(ejabberd_config, get_global_option, [{shaper, mam_shaper, global}]),
Norm = rpc_apply(ejabberd_config, get_global_option, [{shaper, normal, global}]),
Fast = rpc_apply(ejabberd_config, get_global_option, [{shaper, fast, global}]),
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_global_option, [{shaper, mam_shaper, global}, Mam]),
rpc_apply(ejabberd_config, add_global_option, [{shaper, normal, global}, Norm]),
rpc_apply(ejabberd_config, add_global_option, [{shaper, fast, global}, 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) ->
Expand All @@ -576,10 +576,10 @@ restore_sessions_limit(Config) ->
Config.

get_sessions_limit() ->
rpc_apply(ejabberd_config, get_global_option, [{access, max_user_sessions, global}]).
rpc_apply(ejabberd_config, get_local_option, [{access, max_user_sessions, global}]).

set_sessions_limit(NewLimit) ->
rpc_apply(ejabberd_config, add_global_option,
rpc_apply(ejabberd_config, add_local_option,
[{access, max_user_sessions, global}, NewLimit]).

init_per_group(mam04, Config) ->
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/mongoose_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ mnesia_or_rdbms_backend() ->

-spec auth_modules() -> [atom()].
auth_modules() ->
Hosts = rpc(mim(), ejabberd_config, get_global_option, [hosts]),
Hosts = rpc(mim(), ejabberd_config, get_local_option, [hosts]),
lists:flatmap(
fun(Host) ->
rpc(mim(), ejabberd_auth, auth_modules, [Host])
Expand Down
4 changes: 2 additions & 2 deletions big_tests/tests/muc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2996,8 +2996,8 @@ create_and_destroy_room_multiple_x_elements(Config) ->
%% ejabberd returns 'forbidden' while it ought to return 'not-allowed'.
room_creation_not_allowed(Config) ->
escalus:story(Config, [{alice, 1}], fun(Alice) ->
escalus_ejabberd:with_global_option({access,muc_create,global},
[{deny,all}], fun() ->
escalus_ejabberd:with_local_option({access, muc_create, global},
[{deny, all}], fun() ->
escalus:send(Alice, stanza_enter_room(<<"room1">>, <<"nick1">>)),
escalus:assert(is_error, [<<"cancel">>, <<"not-allowed">>],
escalus:wait_for_stanza(Alice))
Expand Down
9 changes: 1 addition & 8 deletions big_tests/tests/users_api_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
require_rpc_nodes/1,
rpc/4]).
-import(rest_helper, [assert_status/2, simple_request/2, simple_request/3, simple_request/4]).

-import(domain_helper, [domain/0]).
-import(mongoose_helper, [auth_modules/0]).

-define(DOMAIN, (domain())).
-define(PORT, (ct:get_config({hosts, mim, metrics_rest_port}))).
Expand Down Expand Up @@ -140,13 +140,6 @@ is_external_auth() ->
is_riak_auth() ->
lists:member(ejabberd_auth_riak, auth_modules()).

auth_modules() ->
Hosts = rpc(mim(), ejabberd_config, get_global_option, [hosts]),
lists:flatmap(
fun(Host) ->
rpc(mim(), ejabberd_auth, auth_modules, [Host])
end, Hosts).

wait_for_user_removal(false) ->
ok;
wait_for_user_removal(_) ->
Expand Down

0 comments on commit 65849dc

Please sign in to comment.