Skip to content

Commit 90bbdf3

Browse files
committed
Simplify inbox_helper:maybe_run_in_parallel/1
1 parent 2ca9a37 commit 90bbdf3

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

big_tests/tests/ct_helper.erl

Lines changed: 15 additions & 1 deletion
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/inbox_helper.erl

Lines changed: 4 additions & 19 deletions
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
[

0 commit comments

Comments
 (0)