Skip to content

Commit

Permalink
Fix tests for dynamic domains
Browse files Browse the repository at this point in the history
  • Loading branch information
Premwoik committed Sep 7, 2021
1 parent 3820ff1 commit d22fef3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
22 changes: 10 additions & 12 deletions big_tests/tests/accounts_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ all() ->
].

groups() ->
G = [{register, [parallel], [register,
[{register, [parallel], [register,
already_registered,
registration_conflict,
check_unregistered]},
Expand All @@ -52,8 +52,7 @@ groups() ->
count_users,
count_selected_users]},
{users_number_estimate, [], [count_users_estimate]}
],
ct_helper:repeat_all_until_all_ok(G).
].

suite() ->
require_rpc_nodes([mim]) ++ escalus:suite().
Expand Down Expand Up @@ -91,7 +90,7 @@ 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),
mongoose_helper:set_store_password(host_type(), plain),
[{escalus_user_db, {module, escalus_ejabberd}} |Config1];
init_per_group(registration_timeout, Config) ->
set_registration_timeout(Config);
Expand Down Expand Up @@ -126,12 +125,12 @@ end_per_group(_GroupName, Config) ->
Config.

get_auth_opts() ->
rpc(mim(), ejabberd_config, get_local_option, [{auth_opts, domain()}]).
rpc(mim(), ejabberd_config, get_local_option, [{auth_opts, host_type()}]).

set_auth_opts(AuthOpts) ->
rpc(mim(), ejabberd_auth, stop, [domain()]),
rpc(mim(), ejabberd_config, add_local_option, [{auth_opts, domain()}, AuthOpts]),
rpc(mim(), ejabberd_auth, start, [domain()]).
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()]).

init_per_testcase(admin_notify, Config) ->
[{_, AdminSpec}] = escalus_users:get_users([admin]),
Expand Down Expand Up @@ -445,13 +444,13 @@ user_exists(Name, Config) ->
rpc(mim(), ejabberd_auth, does_user_exist, [mongoose_helper:make_jid(Username, Server)]).

reload_mod_register_option(Config, Key, Value) ->
Host = domain(),
Host = host_type(),
Args = proplists:get_value(mod_register_options, Config),
Args1 = lists:keyreplace(Key, 1, Args, {Key, Value}),
dynamic_modules:restart(Host, mod_register, Args1).

restore_mod_register_options(Config) ->
Host = domain(),
Host = host_type(),
Args = proplists:get_value(mod_register_options, Config),
dynamic_modules:restart(Host, mod_register, Args).

Expand All @@ -462,8 +461,7 @@ disable_watcher(Config) ->
restore_mod_register_options(Config).

host_type() ->
<<"test type">>.
%domain_helper:host_type(mim).
domain_helper:host_type(mim).

domain() ->
ct:get_config({hosts, mim, domain}).
5 changes: 5 additions & 0 deletions big_tests/tests/mongoose_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
-export([backup_sasl_mechanisms_config/1, restore_sasl_mechanisms_config/1]).
-export([set_sasl_mechanisms/2]).
-export([set_store_password/1]).
-export([set_store_password/2]).
-export([get_listener_opts/2]).
-export([restart_listener_with_opts/3]).
-export([should_minio_be_running/1]).
Expand Down Expand Up @@ -478,6 +479,10 @@ restore_sasl_mechanisms_config(Config) ->
set_sasl_mechanisms(GlobalOrHostSASLMechanisms, Mechanisms) ->
rpc(mim(), ejabberd_config, add_local_option, [GlobalOrHostSASLMechanisms, Mechanisms]).

set_store_password(HostType, Type) ->
AuthOpts = rpc(mim(), ejabberd_config, get_local_option, [{auth_opts, HostType}]),
NewAuthOpts = build_new_auth_opts(Type, AuthOpts),
rpc(mim(), ejabberd_config, add_local_option, [{auth_opts, HostType}, NewAuthOpts]).

set_store_password(Type) ->
XMPPDomain = escalus_ejabberd:unify_str_arg(
Expand Down

0 comments on commit d22fef3

Please sign in to comment.