Merge branch 'stable'

This commit is contained in:
Jean-Sébastien Pédron 2017-06-28 16:51:40 +02:00
commit fb91ddd0ca
2 changed files with 49 additions and 12 deletions

View File

@ -1250,21 +1250,25 @@ clear_global_parameter(Config, Node, Name) ->
%% ------------------------------------------------------------------- %% -------------------------------------------------------------------
enable_plugin(Config, Node, Plugin) -> enable_plugin(Config, Node, Plugin) ->
plugin_action(Config, Node, enable, [Plugin], []). plugin_action(Config, Node, [enable, Plugin]).
disable_plugin(Config, Node, Plugin) -> disable_plugin(Config, Node, Plugin) ->
plugin_action(Config, Node, disable, [Plugin], []). plugin_action(Config, Node, [disable, Plugin]).
plugin_action(Config, Node, Command, Args, Opts) -> plugin_action(Config, Node, Args) ->
PluginsFile = rabbit_ct_broker_helpers:get_node_config(Config, Node, Rabbitmqplugins = ?config(rabbitmq_plugins_cmd, Config),
enabled_plugins_file), NodeConfig = get_node_config(Config, Node),
PluginsDir = rabbit_ct_broker_helpers:get_node_config(Config, Node, Nodename = ?config(nodename, NodeConfig),
plugins_dir), Env = [
Nodename = rabbit_ct_broker_helpers:get_node_config(Config, Node, {"RABBITMQ_PID_FILE", ?config(pid_file, NodeConfig)},
nodename), {"RABBITMQ_MNESIA_DIR", ?config(mnesia_dir, NodeConfig)},
rabbit_ct_broker_helpers:rpc(Config, Node, {"RABBITMQ_PLUGINS_DIR", ?config(plugins_dir, NodeConfig)},
rabbit_plugins_main, action, {"RABBITMQ_ENABLED_PLUGINS_FILE",
[Command, Nodename, Args, Opts, PluginsFile, PluginsDir]). ?config(enabled_plugins_file, NodeConfig)}
],
Cmd = [Rabbitmqplugins, "-n", Nodename | Args],
{ok, _} = rabbit_ct_helpers:exec(Cmd, [{env, Env}]),
ok.
%% ------------------------------------------------------------------- %% -------------------------------------------------------------------

View File

@ -72,6 +72,7 @@ run_setup_steps(Config, ExtraSteps) ->
fun ensure_erl_call_cmd/1, fun ensure_erl_call_cmd/1,
fun ensure_rabbitmqctl_cmd/1, fun ensure_rabbitmqctl_cmd/1,
fun ensure_rabbitmqctl_app/1, fun ensure_rabbitmqctl_app/1,
fun ensure_rabbitmq_plugins_cmd/1,
fun ensure_ssl_certs/1, fun ensure_ssl_certs/1,
fun start_long_running_testsuite_monitor/1 fun start_long_running_testsuite_monitor/1
], ],
@ -301,6 +302,38 @@ ensure_rabbitmqctl_app(Config) ->
"please build rabbitmq_cli and set MIX_ENV"} "please build rabbitmq_cli and set MIX_ENV"}
end. end.
ensure_rabbitmq_plugins_cmd(Config) ->
Rabbitmqplugins = case get_config(Config, rabbitmq_plugins_cmd) of
undefined ->
case os:getenv("RABBITMQ_PLUGINS") of
false ->
SrcDir = ?config(rabbit_srcdir, Config),
R = filename:join(SrcDir, "scripts/rabbitmq-plugins"),
case filelib:is_file(R) of
true -> R;
false -> false
end;
R ->
R
end;
R ->
R
end,
Error = {skip, "rabbitmq_plugins required, " ++
"please set RABBITMQ_PLUGINS or 'rabbitmq_plugins_cmd' in ct config"},
case Rabbitmqplugins of
false ->
Error;
_ ->
Cmd = [Rabbitmqplugins],
case exec(Cmd, [drop_stdout]) of
{error, 64, _} ->
set_config(Config, {rabbitmq_plugins_cmd, Rabbitmqplugins});
_ ->
Error
end
end.
ensure_ssl_certs(Config) -> ensure_ssl_certs(Config) ->
SrcDir = ?config(rabbitmq_ct_helpers_srcdir, Config), SrcDir = ?config(rabbitmq_ct_helpers_srcdir, Config),
CertsMakeDir = filename:join([SrcDir, "tools", "tls-certs"]), CertsMakeDir = filename:join([SrcDir, "tools", "tls-certs"]),