Skip to content

Commit ddfb01b

Browse files
authoredMar 13, 2025··
Merge pull request #4505 from esl/non-parallel-fast-auth-tests-for-mssql
Port solution to run tests sequentially for mssql from the listeners branch
2 parents a586668 + 90bbdf3 commit ddfb01b

File tree

5 files changed

+34
-30
lines changed

5 files changed

+34
-30
lines changed
 

‎big_tests/tests/ct_helper.erl

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
repeat_all_until_any_fail/2,
77
groups_to_all/1,
88
get_preset_var/3,
9-
get_internal_database/0]).
9+
get_internal_database/0,
10+
add_params_to_list/3]).
1011

1112
-type group_name() :: atom().
1213

@@ -131,3 +132,16 @@ get_internal_database() ->
131132
{ok, _} -> cets;
132133
{error, not_found} -> mnesia
133134
end.
135+
136+
add_params_to_list(Groups, [], _IgnoreNames) ->
137+
Groups;
138+
add_params_to_list(Groups, NewParams, IgnoreNames) ->
139+
[add_params(Group, NewParams, IgnoreNames) || Group <- Groups].
140+
141+
add_params({Name, Params, Tests} = Group, NewParams, IgnoreNames) ->
142+
case lists:member(Name, IgnoreNames) of
143+
true ->
144+
Group;
145+
false ->
146+
{Name, NewParams ++ Params, Tests}
147+
end.

‎big_tests/tests/fast_auth_token_SUITE.erl

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ all() ->
2121
[{group, Group} || {Group, _, _} <- groups()].
2222

2323
groups() ->
24-
[{Group, [parallel], tests()} || {Group, _Mech} <- mechanisms()].
24+
Parallel = distributed_helper:maybe_parallel_group(),
25+
[{Group, Parallel, tests()} || {Group, _Mech} <- mechanisms()].
2526

2627
tests() ->
2728
[server_advertises_support_for_fast,

‎big_tests/tests/inbox_helper.erl

+4-19
Original file line numberDiff line numberDiff line change
@@ -144,26 +144,11 @@ skip_or_run_inbox_tests(TestCases) ->
144144
end.
145145

146146
maybe_run_in_parallel(Gs) ->
147-
%% These could be parallel but it seems like mssql CI can't handle the load
148-
case distributed_helper:rpc(
149-
distributed_helper:mim(), mongoose_rdbms, db_engine, [domain_helper:host_type()]) of
150-
odbc -> Gs;
151-
_ -> insert_parallels(Gs)
152-
end.
147+
NewParams = distributed_helper:maybe_parallel_group(),
148+
ct_helper:add_params_to_list(Gs, NewParams, non_parallel_groups()).
153149

154-
insert_parallels(Gs) ->
155-
Fun = fun({muclight_config, Conf, Tests}) ->
156-
{muclight_config, Conf, Tests};
157-
({bin, Conf, Tests}) ->
158-
{bin, Conf, Tests};
159-
({regular, Conf, Tests}) ->
160-
{regular, Conf, Tests};
161-
({async_pools, Conf, Tests}) ->
162-
{async_pools, Conf, Tests};
163-
({Group, Conf, Tests}) ->
164-
{Group, [parallel | Conf], Tests}
165-
end,
166-
lists:map(Fun, Gs).
150+
non_parallel_groups() ->
151+
[muclight_config, bin, regular, async_pools].
167152

168153
inbox_modules(Backend) ->
169154
[

‎big_tests/tests/service_domain_db_SUITE.erl

+1-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ all() ->
3535
].
3636

3737
groups() ->
38-
ParallelConfig = parallel_config(),
38+
ParallelConfig = distributed_helper:maybe_parallel_group(),
3939
[
4040
{no_db, ParallelConfig, no_db_cases()},
4141
{db, [], [
@@ -62,14 +62,6 @@ groups() ->
6262
{rest_db_fails, [], rest_db_fails_cases()}
6363
].
6464

65-
parallel_config() ->
66-
%% These could be parallel but it seems like mssql CI can't handle the load
67-
case distributed_helper:rpc(
68-
distributed_helper:mim(), mongoose_rdbms, db_engine, [domain_helper:host_type()]) of
69-
odbc -> [];
70-
_ -> [parallel]
71-
end.
72-
7365
no_db_cases() -> [
7466
api_lookup_works,
7567
api_lookup_not_found,

‎test/common/distributed_helper.erl

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ is_sm_distributed() ->
2020
is_sm_backend_distributed(ejabberd_sm_mnesia) -> true;
2121
is_sm_backend_distributed(Other) -> {false, Other}.
2222

23+
db_engine() ->
24+
rpc(mim(), mongoose_rdbms, db_engine, [domain_helper:host_type()]).
25+
26+
%% To avoid DB timeouts, disables parallel execution for MSSQL
27+
maybe_parallel_group() ->
28+
case catch db_engine() of
29+
odbc ->
30+
[];
31+
_ ->
32+
[parallel]
33+
end.
34+
2335
add_node_to_cluster(Config) ->
2436
Node2 = mim2(),
2537
add_node_to_cluster(Node2, Config).

0 commit comments

Comments
 (0)
Please sign in to comment.