Skip to content

Commit 655caf6

Browse files
committed
Make CI: Have ct_master return the test results
Instead of having a CT hook just to know whether our tests failed.
1 parent dddf917 commit 655caf6

File tree

4 files changed

+19
-58
lines changed

4 files changed

+19
-58
lines changed

deps/rabbit/Makefile

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,16 @@ define ct_master.erl
239239
peer:call(Pid2, persistent_term, put, [rabbit_ct_tcp_port_base, 25000]),
240240
peer:call(Pid3, persistent_term, put, [rabbit_ct_tcp_port_base, 27000]),
241241
peer:call(Pid4, persistent_term, put, [rabbit_ct_tcp_port_base, 29000]),
242-
ct_master_fork:run("$1"),
243-
Fail1 = peer:call(Pid1, cth_parallel_ct_detect_failure, has_failures, []),
244-
Fail2 = peer:call(Pid2, cth_parallel_ct_detect_failure, has_failures, []),
245-
Fail3 = peer:call(Pid3, cth_parallel_ct_detect_failure, has_failures, []),
246-
Fail4 = peer:call(Pid4, cth_parallel_ct_detect_failure, has_failures, []),
242+
[{[_], {ok, Results}}] = ct_master_fork:run("$1"),
247243
peer:stop(Pid4),
248244
peer:stop(Pid3),
249245
peer:stop(Pid2),
250246
peer:stop(Pid1),
251-
if
252-
Fail1 -> halt(1);
253-
Fail2 -> halt(2);
254-
Fail3 -> halt(3);
255-
Fail4 -> halt(4);
256-
true -> halt(0)
257-
end
247+
lists:foldl(fun
248+
({_, {_, 0, {_, 0}}}, Err) -> Err + 1;
249+
(What, Peer) -> halt(Peer)
250+
end, 1, Results),
251+
halt(0)
258252
endef
259253

260254
PARALLEL_CT_SET_1_A = amqp_client unit_cluster_formation_locking_mocks unit_cluster_formation_sort_nodes unit_collections unit_config_value_encryption unit_connection_tracking
@@ -293,15 +287,13 @@ define tpl_parallel_ct_test_spec
293287
{logdir, "$(CT_LOGS_DIR)"}.
294288
{logdir, master, "$(CT_LOGS_DIR)"}.
295289
{create_priv_dir, all_nodes, auto_per_run}.
290+
{auto_compile, false}.
296291

297292
{node, shard1, 'rabbit_shard1@localhost'}.
298293
{node, shard2, 'rabbit_shard2@localhost'}.
299294
{node, shard3, 'rabbit_shard3@localhost'}.
300295
{node, shard4, 'rabbit_shard4@localhost'}.
301296

302-
{auto_compile, false}.
303-
{ct_hooks, [cth_parallel_ct_detect_failure]}.
304-
305297
{define, 'Set1', [$(call comma_list,$(addsuffix _SUITE,$1))]}.
306298
{define, 'Set2', [$(call comma_list,$(addsuffix _SUITE,$2))]}.
307299
{define, 'Set3', [$(call comma_list,$(addsuffix _SUITE,$3))]}.

deps/rabbitmq_ct_helpers/src/ct_master_fork.erl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,7 @@ run_all([],#testspec{
392392
end,
393393
log(tty,"Master Logdir","~ts",[MasterLogDir]),
394394
start_master(lists:reverse(NodeOpts),Handlers,MasterLogDir,
395-
LogDirsRun,InitOptions,Specs),
396-
ok.
395+
LogDirsRun,InitOptions,Specs).
397396

398397

399398
%-doc """
@@ -581,18 +580,19 @@ init_master2(Parent,NodeOptsList,LogDirs) ->
581580
Parent ! {self(),Result}.
582581

583582
master_loop(#state{node_ctrl_pids=[],
584-
results=Finished}) ->
583+
results=Finished0}) ->
584+
Finished = lists:sort(Finished0),
585585
Str =
586586
lists:map(fun({Node,Result}) ->
587587
io_lib:format("~-40.40.*ts~tp\n",
588588
[$_,atom_to_list(Node),Result])
589-
end,lists:sort(Finished)),
589+
end,Finished),
590590
log(all,"TEST RESULTS","~ts", [Str]),
591591
log(all,"Info","Updating log files",[]),
592592

593593
ct_master_event_fork:stop(),
594594
ct_master_logs_fork:stop(),
595-
ok;
595+
{ok, Finished};
596596

597597
master_loop(State=#state{node_ctrl_pids=NodeCtrlPids,
598598
results=Results,

deps/rabbitmq_ct_helpers/src/cth_parallel_ct_detect_failure.erl

Lines changed: 0 additions & 23 deletions
This file was deleted.

deps/rabbitmq_mqtt/Makefile

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,16 @@ define ct_master.erl
8282
peer:call(Pid2, persistent_term, put, [rabbit_ct_tcp_port_base, 25000]),
8383
peer:call(Pid3, persistent_term, put, [rabbit_ct_tcp_port_base, 27000]),
8484
peer:call(Pid4, persistent_term, put, [rabbit_ct_tcp_port_base, 29000]),
85-
ct_master_fork:run("$1"),
86-
Fail1 = peer:call(Pid1, cth_parallel_ct_detect_failure, has_failures, []),
87-
Fail2 = peer:call(Pid2, cth_parallel_ct_detect_failure, has_failures, []),
88-
Fail3 = peer:call(Pid3, cth_parallel_ct_detect_failure, has_failures, []),
89-
Fail4 = peer:call(Pid4, cth_parallel_ct_detect_failure, has_failures, []),
85+
[{[_], {ok, Results}}] = ct_master_fork:run("$1"),
9086
peer:stop(Pid4),
9187
peer:stop(Pid3),
9288
peer:stop(Pid2),
9389
peer:stop(Pid1),
94-
if
95-
Fail1 -> halt(1);
96-
Fail2 -> halt(2);
97-
Fail3 -> halt(3);
98-
Fail4 -> halt(4);
99-
true -> halt(0)
100-
end
90+
lists:foldl(fun
91+
({_, {_, 0, {_, 0}}}, Err) -> Err + 1;
92+
(What, Peer) -> halt(Peer)
93+
end, 1, Results),
94+
halt(0)
10195
endef
10296

10397
PARALLEL_CT_SET_1_A = auth retainer
@@ -116,15 +110,13 @@ define tpl_parallel_ct_test_spec
116110
{logdir, "$(CT_LOGS_DIR)"}.
117111
{logdir, master, "$(CT_LOGS_DIR)"}.
118112
{create_priv_dir, all_nodes, auto_per_run}.
113+
{auto_compile, false}.
119114

120115
{node, shard1, 'rabbit_shard1@localhost'}.
121116
{node, shard2, 'rabbit_shard2@localhost'}.
122117
{node, shard3, 'rabbit_shard3@localhost'}.
123118
{node, shard4, 'rabbit_shard4@localhost'}.
124119

125-
{auto_compile, false}.
126-
{ct_hooks, [cth_parallel_ct_detect_failure]}.
127-
128120
{define, 'Set1', [$(call comma_list,$(addsuffix _SUITE,$1))]}.
129121
{define, 'Set2', [$(call comma_list,$(addsuffix _SUITE,$2))]}.
130122
{define, 'Set3', [$(call comma_list,$(addsuffix _SUITE,$3))]}.

0 commit comments

Comments
 (0)