diff --git a/big_tests/tests/auth_methods_for_c2s_SUITE.erl b/big_tests/tests/auth_methods_for_c2s_SUITE.erl index 689e16c7250..b072dacb21a 100644 --- a/big_tests/tests/auth_methods_for_c2s_SUITE.erl +++ b/big_tests/tests/auth_methods_for_c2s_SUITE.erl @@ -33,12 +33,12 @@ end_per_suite(Config) -> escalus:end_per_suite(Config). init_per_group(metrics, Config) -> - Config; + set_auth_mod(Config); init_per_group(_, Config0) -> Config1 = ejabberd_node_utils:init(Config0), ejabberd_node_utils:backup_config_file(Config1), - modify_config_and_restart(Config1), - escalus_cleaner:start(Config1). + Config2 = modify_config_and_restart(Config1), + escalus_cleaner:start(Config2). end_per_group(metrics, _Config) -> escalus_fresh:clean(); @@ -49,7 +49,7 @@ end_per_group(_, Config) -> init_per_testcase(TC, Config) -> Spec = escalus_fresh:freshen_spec(Config, alice), - Clean = register_internal_user(Spec), + Clean = register_user(Config, Spec), [{clean_fn, Clean}, {spec, Spec}|escalus:init_per_testcase(TC, Config)]. end_per_testcase(TC, Config) -> @@ -57,12 +57,28 @@ end_per_testcase(TC, Config) -> Clean(), escalus:end_per_testcase(TC, Config). +set_auth_mod(Config) -> + Mod = case mongoose_helper:is_rdbms_enabled(domain_helper:host_type()) of + true -> + ejabberd_auth_rdbms; + false -> + ejabberd_auth_internal + end, + [{auth_mod, Mod} | Config]. + modify_config_and_restart(Config) -> - NewConfigValues = [{auth_method, "internal]\n [auth.dummy"}, + {Method, Mod} = case mongoose_helper:is_rdbms_enabled(domain_helper:host_type()) of + true -> + {"rdbms", ejabberd_auth_rdbms}; + false -> + {"internal", ejabberd_auth_internal} + end, + NewConfigValues = [{auth_method, Method ++ "]\n [auth.dummy"}, {auth_method_opts, false}, - {allowed_auth_methods, "\"internal\""}], + {allowed_auth_methods, "\"" ++ Method ++ "\""}], ejabberd_node_utils:modify_config_file(NewConfigValues, Config), - ejabberd_node_utils:restart_application(mongooseim). + ejabberd_node_utils:restart_application(mongooseim), + [{auth_mod, Mod} | Config]. can_login_with_allowed_method(Config) -> Spec = proplists:get_value(spec, Config), @@ -94,13 +110,14 @@ metrics_incremented_on_user_connect(ConfigIn) -> %% Helpers %% If dummy backend is enabled, it is not possible to create new users %% (we check if an user does exist before registering the user). -register_internal_user(Spec) -> +register_user(Config, Spec) -> + Mod = proplists:get_value(auth_mod, Config), #{username := User, server := Server, password := Password} = maps:from_list(Spec), LUser = jid:nodeprep(User), LServer = escalus_utils:jid_to_lower(Server), HostType = domain_helper:host_type(), - rpc(mim(), ejabberd_auth_internal, try_register, + ok = rpc(mim(), Mod, try_register, [HostType, LUser, LServer, Password]), - fun() -> rpc(mim(), ejabberd_auth_internal, remove_user, + fun() -> rpc(mim(), Mod, remove_user, [HostType, LUser, LServer]) end. diff --git a/big_tests/tests/mod_global_distrib_SUITE.erl b/big_tests/tests/mod_global_distrib_SUITE.erl index 14b91b6fc64..266f4bb2c4f 100644 --- a/big_tests/tests/mod_global_distrib_SUITE.erl +++ b/big_tests/tests/mod_global_distrib_SUITE.erl @@ -120,8 +120,12 @@ init_per_suite(Config) -> case {rpc(europe_node1, mongoose_wpool, get_worker, [redis, global, global_distrib]), rpc(asia_node, mongoose_wpool, get_worker, [redis, global, global_distrib])} of {{ok, _}, {ok, _}} -> - ok = rpc(europe_node2, mongoose_cluster, join, [ct:get_config(europe_node1)]), - + case ct_helper:get_internal_database() of + mnesia -> + ok = rpc(europe_node2, mongoose_cluster, join, [ct:get_config(europe_node1)]); + _ -> + ok + end, enable_logging(), escalus:init_per_suite([{add_advertised_endpoints, []}, {extra_config, #{}} | Config]); Result -> diff --git a/src/mongoose_internal_databases.erl b/src/mongoose_internal_databases.erl index 79eb4ff88f1..97d2b985460 100644 --- a/src/mongoose_internal_databases.erl +++ b/src/mongoose_internal_databases.erl @@ -10,8 +10,7 @@ init() -> %% Ensure mnesia is stopped when applying the test presets from the big tests. %% So, we accidentually do not test with mnesia enabled, when starting the %% test cases from the clean test build. - %% TODO Stopping here would break a lot of tests, stop here once tests are fixed. - % mnesia:stop(), + mnesia:stop(), ok end.