25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Don't start hosts for disabled backends from CT_BACKENDS passed to make test

This commit is contained in:
Paweł Chmielowski 2017-11-03 14:44:13 +01:00
parent 90e1f3f29d
commit ec3ea61585

View File

@ -70,8 +70,22 @@ init_config(Config) ->
{pgsql_user, <<"ejabberd_test">>}, {pgsql_user, <<"ejabberd_test">>},
{pgsql_pass, <<"ejabberd_test">>} {pgsql_pass, <<"ejabberd_test">>}
]), ]),
Backends = get_config_backends(),
io:format(standard_error, "BACKENT ~p~n", [Backends]),
HostTypes = re:split(CfgContent, "(\\s*- \"(.*)\\.localhost\")",
[group, {return, binary}]),
CfgContent2 = lists:foldl(fun([Pre, Frag, Type], Acc) ->
case Backends == all orelse lists:member(binary_to_list(Type), Backends) of
true ->
<<Acc/binary, Pre/binary, Frag/binary>>;
_ ->
<<Acc/binary, Pre/binary>>
end;
([Rest], Acc) ->
<<Acc/binary, Rest/binary>>
end, <<>>, HostTypes),
ConfigPath = filename:join([CWD, "ejabberd.yml"]), ConfigPath = filename:join([CWD, "ejabberd.yml"]),
ok = file:write_file(ConfigPath, CfgContent), ok = file:write_file(ConfigPath, CfgContent2),
setup_ejabberd_lib_path(Config), setup_ejabberd_lib_path(Config),
ok = application:load(sasl), ok = application:load(sasl),
ok = application:load(mnesia), ok = application:load(mnesia),
@ -111,7 +125,7 @@ init_config(Config) ->
{master_resource, <<"master_resource!@#$%^&*()'\"`~<>+-/;:_=[]{}|\\">>}, {master_resource, <<"master_resource!@#$%^&*()'\"`~<>+-/;:_=[]{}|\\">>},
{slave_resource, <<"slave_resource!@#$%^&*()'\"`~<>+-/;:_=[]{}|\\">>}, {slave_resource, <<"slave_resource!@#$%^&*()'\"`~<>+-/;:_=[]{}|\\">>},
{password, Password}, {password, Password},
{backends, get_config_backends()} {backends, Backends}
|Config]. |Config].
find_top_dir(Dir) -> find_top_dir(Dir) ->