Skip to content

Commit 12d6dc4

Browse files
committed
WIP
1 parent 7c4beda commit 12d6dc4

File tree

6 files changed

+62
-16
lines changed

6 files changed

+62
-16
lines changed

.github/workflows/test-make.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104

105105
- name: RUN TESTS
106106
run: |
107-
make -C deps/rabbit ct-cluster_upgrade RABBITMQ_RUN_SECONDARY=rabbitmq-server-4.0.2/
107+
make -C deps/rabbit ct-cluster_upgrade SECONDARY_DIST=rabbitmq-server-4.0.2/
108108
109109
- name: UPLOAD TEST LOGS
110110
if: always()

deps/rabbit/test/cluster_upgrade_SUITE.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ init_per_testcase(Testcase, Config) ->
5555
Config1 = rabbit_ct_helpers:set_config(Config, [
5656
{rmq_nodename_suffix, Testcase},
5757
{rmq_nodes_count, 3},
58-
{force_secondary_umbrella, true}
58+
{force_secondary, true}
5959
]),
6060
Config2 = rabbit_ct_helpers:run_steps(Config1,
6161
rabbit_ct_broker_helpers:setup_steps() ++
@@ -139,7 +139,7 @@ upgrade_cluster(Config) ->
139139
|| N <- Cluster],
140140
ct:pal(?LOW_IMPORTANCE, "Restarting cluster ~p", [Cluster]),
141141
Config1 = rabbit_ct_helpers:set_config(
142-
Config, {force_secondary_umbrella, false}),
142+
Config, {force_secondary, false}),
143143
[ok = rabbit_ct_broker_helpers:async_start_node(Config1, N)
144144
|| N <- Cluster],
145145
[ok = rabbit_ct_broker_helpers:wait_for_async_start_node(N)

deps/rabbit_common/mk/rabbitmq-dist.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.PHONY: dist test-dist do-dist cli-scripts cli-escripts clean-dist
22

3-
DIST_DIR = plugins
4-
CLI_SCRIPTS_DIR = sbin
5-
CLI_ESCRIPTS_DIR = escript
3+
DIST_DIR ?= $(CURDIR)/plugins
4+
CLI_SCRIPTS_DIR ?= $(CURDIR)/sbin
5+
CLI_ESCRIPTS_DIR ?= $(CURDIR)/escript
66
MIX = echo y | mix
77

88
# Set $(DIST_AS_EZS) to a non-empty value to enable the packaging of

deps/rabbit_common/mk/rabbitmq-run.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ TEST_TMPDIR ?= $(TMPDIR)/rabbitmq-test-instances
1919
endif
2020

2121
# Location of the scripts controlling the broker.
22-
RABBITMQ_SCRIPTS_DIR ?= $(CURDIR)/sbin
22+
RABBITMQ_SCRIPTS_DIR ?= $(CLI_SCRIPTS_DIR)
2323

2424
ifeq ($(PLATFORM),msys2)
2525
RABBITMQ_PLUGINS ?= $(RABBITMQ_SCRIPTS_DIR)/rabbitmq-plugins.bat
@@ -39,7 +39,7 @@ export RABBITMQ_SCRIPTS_DIR RABBITMQCTL RABBITMQ_PLUGINS RABBITMQ_SERVER RABBITM
3939
export MAKE
4040

4141
# We need to pass the location of codegen to the Java client ant
42-
# process.
42+
# process. @todo Delete?
4343
CODEGEN_DIR = $(DEPS_DIR)/rabbitmq_codegen
4444
PYTHONPATH = $(CODEGEN_DIR)
4545
export PYTHONPATH
@@ -90,7 +90,7 @@ ifdef PLUGINS_FROM_DEPS_DIR
9090
RMQ_PLUGINS_DIR = $(DEPS_DIR)
9191
DIST_ERL_LIBS = $(ERL_LIBS)
9292
else
93-
RMQ_PLUGINS_DIR = $(CURDIR)/$(DIST_DIR)
93+
RMQ_PLUGINS_DIR = $(DIST_DIR)
9494
# We do not want to add apps/ or deps/ to ERL_LIBS
9595
# when running the release from dist. The `plugins`
9696
# directory is added to ERL_LIBS by rabbitmq-env.

deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,13 +634,17 @@ do_start_rabbitmq_node(Config, NodeConfig, I) ->
634634
false -> WithPlugins0
635635
end,
636636
ForceUseSecondary = rabbit_ct_helpers:get_config(
637-
Config, force_secondary_umbrella, undefined),
637+
Config, force_secondary, undefined),
638638
CanUseSecondary = case ForceUseSecondary of
639639
undefined ->
640640
(I + 1) rem 2 =:= 0;
641641
Override when is_boolean(Override) ->
642642
Override
643643
end,
644+
UseSecondaryDist = case ?config(secondary_dist, Config) of
645+
false -> false;
646+
_ -> CanUseSecondary
647+
end,
644648
UseSecondaryUmbrella = case ?config(secondary_umbrella, Config) of
645649
false -> false;
646650
_ -> CanUseSecondary
@@ -686,8 +690,15 @@ do_start_rabbitmq_node(Config, NodeConfig, I) ->
686690
StartWithPluginsDisabled = rabbit_ct_helpers:get_config(
687691
Config, start_rmq_with_plugins_disabled),
688692
ExtraArgs2 = case StartWithPluginsDisabled of
689-
true -> ["LEAVE_PLUGINS_DISABLED=yes" | ExtraArgs1];
690-
_ -> ExtraArgs1
693+
true ->
694+
["LEAVE_PLUGINS_DISABLED=1" | ExtraArgs1];
695+
_ ->
696+
case filename:basename(SrcDir) of
697+
"rabbit" ->
698+
["LEAVE_PLUGINS_DISABLED=1" | ExtraArgs1];
699+
SrcPlugin ->
700+
[{"RABBITMQ_ENABLED_PLUGINS=~ts", [SrcPlugin]} | ExtraArgs1]
701+
end
691702
end,
692703
KeepPidFile = rabbit_ct_helpers:get_config(
693704
Config, keep_pid_file_on_exit),
@@ -731,7 +742,18 @@ do_start_rabbitmq_node(Config, NodeConfig, I) ->
731742
{"RABBITMQ_PLUGINS=~ts/rabbitmq-plugins", [SecScriptsDir]}
732743
| ExtraArgs4];
733744
false ->
734-
ExtraArgs4
745+
case UseSecondaryDist of
746+
true ->
747+
SecondaryDist = ?config(secondary_dist, Config),
748+
[{"DIST_DIR=~ts/plugins", [SecondaryDist]},
749+
{"CLI_SCRIPTS_DIR=~ts/sbin", [SecondaryDist]},
750+
{"CLI_ESCRIPTS_DIR=~ts/escript", [SecondaryDist]},
751+
{"RABBITMQ_SCRIPTS_DIR=~ts/sbin", [SecondaryDist]},
752+
{"RABBITMQ_SERVER=~ts/sbin/rabbitmq-server", [SecondaryDist]}
753+
| ExtraArgs4];
754+
false ->
755+
ExtraArgs4
756+
end
735757
end,
736758
MakeVars = [
737759
{"RABBITMQ_NODENAME=~ts", [Nodename]},
@@ -1285,6 +1307,10 @@ rabbitmqctl(Config, Node, Args, Timeout) ->
12851307
CanUseSecondary = (I + 1) rem 2 =:= 0,
12861308
BazelRunSecCmd = rabbit_ct_helpers:get_config(
12871309
Config, rabbitmq_run_secondary_cmd),
1310+
UseSecondaryDist = case ?config(secondary_dist, Config) of
1311+
false -> false;
1312+
_ -> CanUseSecondary
1313+
end,
12881314
UseSecondaryUmbrella = case ?config(secondary_umbrella, Config) of
12891315
false ->
12901316
case BazelRunSecCmd of
@@ -1327,7 +1353,14 @@ rabbitmqctl(Config, Node, Args, Timeout) ->
13271353
"rabbitmqctl"])
13281354
end;
13291355
false ->
1330-
?config(rabbitmqctl_cmd, Config)
1356+
case UseSecondaryDist of
1357+
true ->
1358+
SecondaryDist = ?config(secondary_dist, Config),
1359+
rabbit_misc:format(
1360+
"~ts/sbin/rabbitmqctl", [SecondaryDist]);
1361+
false ->
1362+
?config(rabbitmqctl_cmd, Config)
1363+
end
13311364
end,
13321365

13331366
NodeConfig = get_node_config(Config, Node),

deps/rabbitmq_ct_helpers/src/rabbit_ct_helpers.erl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ run_setup_steps(Config, ExtraSteps) ->
7878
[
7979
fun init_skip_as_error_flag/1,
8080
fun guess_tested_erlang_app_name/1,
81+
fun ensure_secondary_dist/1,
8182
fun ensure_secondary_umbrella/1,
8283
fun ensure_current_srcdir/1,
8384
fun ensure_rabbitmq_ct_helpers_srcdir/1,
@@ -201,6 +202,16 @@ guess_tested_erlang_app_name(Config) ->
201202
set_config(Config, {tested_erlang_app, list_to_atom(AppName)})
202203
end.
203204

205+
ensure_secondary_dist(Config) ->
206+
Path = case get_config(Config, secondary_dist) of
207+
undefined -> os:getenv("SECONDARY_DIST");
208+
P -> P
209+
end,
210+
case Path =/= false andalso filelib:is_dir(Path) of
211+
true -> set_config(Config, {secondary_dist, Path});
212+
false -> set_config(Config, {secondary_dist, false})
213+
end.
214+
204215
ensure_secondary_umbrella(Config) ->
205216
Path = case get_config(Config, secondary_umbrella) of
206217
undefined -> os:getenv("SECONDARY_UMBRELLA");
@@ -1060,11 +1071,13 @@ convert_to_unicode_binary(Arg) when is_binary(Arg) ->
10601071
Arg.
10611072

10621073
is_mixed_versions() ->
1063-
os:getenv("SECONDARY_UMBRELLA") =/= false
1074+
os:getenv("SECONDARY_DIST") =/= false
1075+
orelse os:getenv("SECONDARY_UMBRELLA") =/= false
10641076
orelse os:getenv("RABBITMQ_RUN_SECONDARY") =/= false.
10651077

10661078
is_mixed_versions(Config) ->
1067-
get_config(Config, secondary_umbrella, false) =/= false
1079+
get_config(Config, secondary_dist, false) =/= false
1080+
orelse get_config(Config, secondary_umbrella, false) =/= false
10681081
orelse get_config(Config, rabbitmq_run_secondary_cmd, false) =/= false.
10691082

10701083
%% -------------------------------------------------------------------

0 commit comments

Comments
 (0)