Skip to content

Commit 5140c1c

Browse files
Merge pull request #14057 from rabbitmq/ct-plugins
CT broker helpers: use rabbitmq-plugins from the given node with a secondary umbrella
2 parents f84828e + e1d71b1 commit 5140c1c

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2375,9 +2375,55 @@ disable_plugin(Config, Node, Plugin) ->
23752375
plugin_action(Config, Node, [disable, Plugin]).
23762376

23772377
plugin_action(Config, Node, Args) ->
2378-
Rabbitmqplugins = ?config(rabbitmq_plugins_cmd, Config),
23792378
NodeConfig = get_node_config(Config, Node),
23802379
Nodename = ?config(nodename, NodeConfig),
2380+
%% We want to use the CLI from the given node if there is a secondary
2381+
%% umbrella being configured.
2382+
I = get_node_index(Config, Node),
2383+
CanUseSecondary = (I + 1) rem 2 =:= 0,
2384+
WithPlugins0 = rabbit_ct_helpers:get_config(Config,
2385+
broker_with_plugins),
2386+
WithPlugins = case is_list(WithPlugins0) of
2387+
true -> lists:nth(I + 1, WithPlugins0);
2388+
false -> WithPlugins0
2389+
end,
2390+
UseSecondaryDist = case ?config(secondary_dist, Config) of
2391+
false -> false;
2392+
_ -> CanUseSecondary
2393+
end,
2394+
UseSecondaryUmbrella = case ?config(secondary_umbrella, Config) of
2395+
false ->
2396+
false;
2397+
_ ->
2398+
CanUseSecondary
2399+
end,
2400+
Rabbitmqplugins = case UseSecondaryUmbrella of
2401+
true ->
2402+
SrcDir = case WithPlugins of
2403+
false ->
2404+
?config(
2405+
secondary_rabbit_srcdir,
2406+
Config);
2407+
_ ->
2408+
?config(
2409+
secondary_current_srcdir,
2410+
Config)
2411+
end,
2412+
SecScriptsDir = filename:join(
2413+
[SrcDir, "sbin"]),
2414+
rabbit_misc:format(
2415+
"~ts/rabbitmq-plugins", [SecScriptsDir]);
2416+
false ->
2417+
case UseSecondaryDist of
2418+
true ->
2419+
SecondaryDist = ?config(secondary_dist, Config),
2420+
rabbit_misc:format(
2421+
"~ts/sbin/rabbitmq-plugins", [SecondaryDist]);
2422+
false ->
2423+
?config(rabbitmq_plugins_cmd, Config)
2424+
end
2425+
end,
2426+
23812427
Env = [
23822428
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(Rabbitmqplugins)},
23832429
{"RABBITMQ_PID_FILE", ?config(pid_file, NodeConfig)},

0 commit comments

Comments
 (0)