Skip to content

Commit f0932e3

Browse files
authored
Merge pull request #11778 from rabbitmq/loic-make-it-big
Make cleanups and ct-master introduction
2 parents c831ae4 + f983cfe commit f0932e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+527
-922
lines changed

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ ADDITIONAL_PLUGINS ?=
2424
DEPS = rabbit_common rabbit $(PLUGINS) $(ADDITIONAL_PLUGINS)
2525

2626
DEP_PLUGINS = rabbit_common/mk/rabbitmq-dist.mk \
27-
rabbit_common/mk/rabbitmq-run.mk \
28-
rabbit_common/mk/rabbitmq-tools.mk
27+
rabbit_common/mk/rabbitmq-run.mk
2928

3029
DISABLE_DISTCLEAN = 1
3130

@@ -61,6 +60,20 @@ include rabbitmq-components.mk
6160
# multiple times (including for release file names and whatnot).
6261
PROJECT_VERSION := $(PROJECT_VERSION)
6362

63+
# Fetch/build community plugins.
64+
#
65+
# To include community plugins in commands, use
66+
# `make COMMUNITY_PLUGINS=1` or export the variable.
67+
# They are not included otherwise. Note that only
68+
# the top-level Makefile can do this.
69+
#
70+
# Note that the community plugins will be fetched using
71+
# SSH and therefore may be subject to GH authentication.
72+
73+
ifdef COMMUNITY_PLUGINS
74+
DEPS += $(RABBITMQ_COMMUNITY)
75+
endif
76+
6477
include erlang.mk
6578
include mk/github-actions.mk
6679
include mk/bazel.mk

deps/amqp10_client/Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,10 @@ DEPS = amqp10_common credentials_obfuscation
3333
TEST_DEPS = rabbit rabbitmq_ct_helpers
3434
LOCAL_DEPS = ssl inets crypto public_key
3535

36-
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-test.mk
36+
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk
37+
# We do not depend on rabbit therefore can't run the broker.
3738
DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \
38-
rabbit_common/mk/rabbitmq-hexpm.mk \
39-
rabbit_common/mk/rabbitmq-dist.mk \
40-
rabbit_common/mk/rabbitmq-run.mk \
41-
rabbit_common/mk/rabbitmq-test.mk \
42-
rabbit_common/mk/rabbitmq-tools.mk
39+
rabbit_common/mk/rabbitmq-hexpm.mk
4340

4441
DEP_PLUGINS += elvis_mk
4542
dep_elvis_mk = git https://github.com/inaka/elvis.mk.git master

deps/amqp10_common/Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ TEST_DEPS = rabbitmq_ct_helpers proper
3838

3939
-include development.pre.mk
4040

41-
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-test.mk
41+
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk
42+
# We do not depend on rabbit therefore can't run the broker.
4243
DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \
43-
rabbit_common/mk/rabbitmq-hexpm.mk \
44-
rabbit_common/mk/rabbitmq-dist.mk \
45-
rabbit_common/mk/rabbitmq-test.mk \
46-
rabbit_common/mk/rabbitmq-tools.mk
44+
rabbit_common/mk/rabbitmq-hexpm.mk
4745

4846
PLT_APPS = eunit
4947

deps/amqp_client/Makefile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ LOCAL_DEPS = xmerl ssl public_key
4343
DEPS = rabbit_common credentials_obfuscation
4444
TEST_DEPS = rabbitmq_ct_helpers rabbit meck
4545

46-
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-test.mk
47-
DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \
48-
rabbit_common/mk/rabbitmq-hexpm.mk \
49-
rabbit_common/mk/rabbitmq-dist.mk \
50-
rabbit_common/mk/rabbitmq-run.mk \
51-
rabbit_common/mk/rabbitmq-test.mk \
52-
rabbit_common/mk/rabbitmq-tools.mk
46+
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk
47+
# We do not depend on rabbit therefore can't run the broker;
48+
# however we can run a test broker in the test suites.
49+
DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk \
50+
rabbit_common/mk/rabbitmq-hexpm.mk
5351

5452
PLT_APPS = ssl public_key
5553

deps/amqp_client/test/system_SUITE.erl

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,16 @@ safe_call_timeouts_test(Params = #amqp_params_network{}) ->
335335
meck:unload(amqp_network_connection);
336336

337337
safe_call_timeouts_test(Params = #amqp_params_direct{}) ->
338+
%% We must mock net_kernel:get_net_ticktime/0 as changing
339+
%% the tick time directly could lead to nodes disconnecting.
340+
meck:new(net_kernel, [unstick, passthrough]),
341+
338342
TestCallTimeout = 30000,
339-
NetTicktime0 = net_kernel:get_net_ticktime(),
340343
amqp_util:update_call_timeout(TestCallTimeout),
341344

342345
%% 1. NetTicktime >= DIRECT_OPERATION_TIMEOUT (120s)
343346
NetTicktime1 = 140,
344-
net_kernel:set_net_ticktime(NetTicktime1, 1),
345-
wait_until_net_ticktime(NetTicktime1),
347+
meck:expect(net_kernel, get_net_ticktime, fun() -> NetTicktime1 end),
346348

347349
{ok, Connection1} = amqp_connection:start(Params),
348350
?assertEqual((NetTicktime1 * 1000) + ?CALL_TIMEOUT_DEVIATION,
@@ -356,15 +358,12 @@ safe_call_timeouts_test(Params = #amqp_params_direct{}) ->
356358

357359
%% 2. Transitioning NetTicktime >= DIRECT_OPERATION_TIMEOUT (120s)
358360
NetTicktime2 = 120,
359-
net_kernel:set_net_ticktime(NetTicktime2, 1),
360-
?assertEqual({ongoing_change_to, NetTicktime2}, net_kernel:get_net_ticktime()),
361+
meck:expect(net_kernel, get_net_ticktime, fun() -> {ongoing_change_to, NetTicktime2} end),
361362

362363
{ok, Connection2} = amqp_connection:start(Params),
363364
?assertEqual((NetTicktime2 * 1000) + ?CALL_TIMEOUT_DEVIATION,
364365
amqp_util:call_timeout()),
365366

366-
wait_until_net_ticktime(NetTicktime2),
367-
368367
?assertEqual(ok, amqp_connection:close(Connection2)),
369368
wait_for_death(Connection2),
370369

@@ -373,15 +372,14 @@ safe_call_timeouts_test(Params = #amqp_params_direct{}) ->
373372

374373
%% 3. NetTicktime < DIRECT_OPERATION_TIMEOUT (120s)
375374
NetTicktime3 = 60,
376-
net_kernel:set_net_ticktime(NetTicktime3, 1),
377-
wait_until_net_ticktime(NetTicktime3),
375+
meck:expect(net_kernel, get_net_ticktime, fun() -> NetTicktime3 end),
378376

379377
{ok, Connection3} = amqp_connection:start(Params),
380378
?assertEqual((?DIRECT_OPERATION_TIMEOUT + ?CALL_TIMEOUT_DEVIATION),
381379
amqp_util:call_timeout()),
382380

383-
net_kernel:set_net_ticktime(NetTicktime0, 1),
384-
wait_until_net_ticktime(NetTicktime0),
381+
meck:unload(net_kernel),
382+
385383
?assertEqual(ok, amqp_connection:close(Connection3)),
386384
wait_for_death(Connection3),
387385

@@ -1578,16 +1576,6 @@ assert_down_with_error(MonitorRef, CodeAtom) ->
15781576
exit(did_not_die)
15791577
end.
15801578

1581-
wait_until_net_ticktime(NetTicktime) ->
1582-
case net_kernel:get_net_ticktime() of
1583-
NetTicktime -> ok;
1584-
{ongoing_change_to, NetTicktime} ->
1585-
timer:sleep(1000),
1586-
wait_until_net_ticktime(NetTicktime);
1587-
_ ->
1588-
throw({error, {net_ticktime_not_set, NetTicktime}})
1589-
end.
1590-
15911579
set_resource_alarm(Resource, Config)
15921580
when Resource =:= memory orelse Resource =:= disk ->
15931581
SrcDir = ?config(amqp_client_srcdir, Config),

deps/oauth2_client/Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ LOCAL_DEPS = ssl inets crypto public_key
99

1010
PLT_APPS = rabbit
1111

12-
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-test.mk
13-
DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \
14-
rabbit_common/mk/rabbitmq-hexpm.mk \
15-
rabbit_common/mk/rabbitmq-dist.mk \
16-
rabbit_common/mk/rabbitmq-run.mk \
17-
rabbit_common/mk/rabbitmq-test.mk \
18-
rabbit_common/mk/rabbitmq-tools.mk
12+
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk
13+
DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk
1914

2015
include rabbitmq-components.mk
2116
include erlang.mk

deps/rabbit/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
/etc/
33
/test/config_schema_SUITE_data/schema/**
44

5-
rabbit-rabbitmq-deps.mk
6-
75
[Bb]in/
86
[Oo]bj/

deps/rabbit/Makefile

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,8 @@ MANPAGES = $(wildcard $(DOCS_DIR)/*.[0-9])
145145
WEB_MANPAGES = $(patsubst %,%.html,$(MANPAGES))
146146
MD_MANPAGES = $(patsubst %,%.md,$(MANPAGES))
147147

148-
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-test.mk
149-
DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \
150-
rabbit_common/mk/rabbitmq-dist.mk \
151-
rabbit_common/mk/rabbitmq-run.mk \
152-
rabbit_common/mk/rabbitmq-test.mk \
153-
rabbit_common/mk/rabbitmq-tools.mk
148+
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk
149+
DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk
154150

155151
include ../../rabbitmq-components.mk
156152
include ../../erlang.mk
@@ -213,8 +209,43 @@ SLOW_CT_SUITES := backing_queue \
213209
vhost
214210
FAST_CT_SUITES := $(filter-out $(sort $(SLOW_CT_SUITES)),$(CT_SUITES))
215211

216-
ct-fast: CT_SUITES = $(FAST_CT_SUITES)
217-
ct-slow: CT_SUITES = $(SLOW_CT_SUITES)
212+
ct-fast:
213+
$(MAKE) ct CT_SUITES='$(FAST_CT_SUITES)'
214+
215+
ct-slow:
216+
$(MAKE) ct CT_SUITES='$(SLOW_CT_SUITES)'
217+
218+
CT_OPTS += -ct_hooks rabbit_ct_hook []
219+
220+
define ct_master.erl
221+
StartOpts = #{
222+
host => "localhost",
223+
connection => standard_io,
224+
args => ["-hidden"]
225+
},
226+
{ok, Pid1, _} = peer:start(StartOpts#{name => "rabbit_shard1"}),
227+
{ok, Pid2, _} = peer:start(StartOpts#{name => "rabbit_shard2"}),
228+
{ok, Pid3, _} = peer:start(StartOpts#{name => "rabbit_shard3"}),
229+
{ok, Pid4, _} = peer:start(StartOpts#{name => "rabbit_shard4"}),
230+
peer:call(Pid1, net_kernel, set_net_ticktime, [5]),
231+
peer:call(Pid2, net_kernel, set_net_ticktime, [5]),
232+
peer:call(Pid3, net_kernel, set_net_ticktime, [5]),
233+
peer:call(Pid4, net_kernel, set_net_ticktime, [5]),
234+
peer:call(Pid1, persistent_term, put, [rabbit_ct_tcp_port_base, 23000]),
235+
peer:call(Pid2, persistent_term, put, [rabbit_ct_tcp_port_base, 25000]),
236+
peer:call(Pid3, persistent_term, put, [rabbit_ct_tcp_port_base, 27000]),
237+
peer:call(Pid4, persistent_term, put, [rabbit_ct_tcp_port_base, 29000]),
238+
ct_master:run("ct.test.spec"),
239+
peer:stop(Pid4),
240+
peer:stop(Pid3),
241+
peer:stop(Pid2),
242+
peer:stop(Pid1),
243+
halt()
244+
endef
245+
246+
ct-master: test-build
247+
$(verbose) mkdir -p $(CT_LOGS_DIR)
248+
$(call erlang,$(ct_master.erl),-sname rabbit_master@localhost -hidden -kernel net_ticktime 5)
218249

219250
# --------------------------------------------------------------------
220251
# Compilation.

0 commit comments

Comments
 (0)