Skip to content

Commit 79aabb6

Browse files
committed
CT: Introduce SECONDARY_DIST_VSN for easier testing
SECONDARY_DIST_VSN takes a version of RabbitMQ to download and use for the SECONDARY_DIST environment. For example: SECONDARY_DIST_VSN=4.2.3 The dist environment is only setup once and is not downloaded again as long as it remains available (ie not deleted). By default the dist environments are in the secondary_dist/ folder at the root of the RabbitMQ repository. This location can be changed using the SECONDARY_DIST_DIR variable which must contain an absolute path to the directory. For example: SECONDARY_DIST_DIR=/home/`whoami`/rabbitmq/secondary_dist/ Combined we can run mixed version tests using a command like: SECONDARY_DIST_VSN=4.2.0 SECONDARY_DIST_DIR=/home/`whoami`/rabbitmq/secondary_dist/ make -C deps/rabbit ct Although SECONDARY_DIST_DIR is best exported from your own shell's rc file if you're going to use it, as this allows sharing the same secondary_dist/ directory across all RabbitMQ clones and worktrees.
1 parent acdb36a commit 79aabb6

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ rabbitmq-server-*.tar.gz
116116
rabbitmq-server-*.tar.bz2
117117
rabbitmq-server-*.tar.xz
118118
rabbitmq-server-*.zip
119+
secondary_dist/
119120

120121
# Trace tools output.
121122
*-ttb

deps/rabbit_common/mk/rabbitmq-early-plugin.mk

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,21 @@ dep_cth_styledout = git https://github.com/rabbitmq/cth_styledout.git master
4242
ifneq ($(strip $(CT_HOOKS)),)
4343
CT_OPTS += -ct_hooks $(CT_HOOKS)
4444
endif
45+
46+
# We fetch a SECONDARY_DIST if SECONDARY_DIST_VSN is set and
47+
# we setup the SECONDARY_DIST variable. The location of the
48+
# secondary dists can be customized using SECONDARY_DIST_DIR
49+
# but note that it only works with an absolute path.
50+
ifneq ($(strip $(SECONDARY_DIST_VSN)),)
51+
SECONDARY_DIST_DIR ?= $(abspath $(CURDIR)/../../)/secondary_dist
52+
SECONDARY_DIST=$(SECONDARY_DIST_DIR)/rabbitmq_server-$(SECONDARY_DIST_VSN)
53+
export SECONDARY_DIST
54+
55+
SECONDARY_DIST_DOWNLOAD_URL = https://github.com/rabbitmq/rabbitmq-server/releases/download/v$(SECONDARY_DIST_VSN)/rabbitmq-server-generic-unix-$(SECONDARY_DIST_VSN).tar.xz
56+
57+
ifeq ($(wildcard $(SECONDARY_DIST)),)
58+
$(shell curl -L -o $(ERLANG_MK_TMP)/rabbitmq_server-$(SECONDARY_DIST_VSN).tar.xz $(SECONDARY_DIST_DOWNLOAD_URL) \
59+
&& mkdir -p $(SECONDARY_DIST) \
60+
&& tar -xf $(ERLANG_MK_TMP)/rabbitmq_server-$(SECONDARY_DIST_VSN).tar.xz -C $(dir $(SECONDARY_DIST)))
61+
endif
62+
endif

deps/rabbitmq_ct_helpers/src/rabbit_ct_helpers.erl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ ensure_application_srcdir(Config, App, _Lang, Module) ->
339339
P ->
340340
P
341341
end,
342-
%% @todo Doesn't account for SECONDARY_DIST.
343342
SecondaryPath = case ?config(secondary_umbrella, Config) of
344343
false ->
345344
Path;

0 commit comments

Comments
 (0)