Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

control_action/2, control_action/3, control_action/4,
rabbitmqctl/3, rabbitmqctl/4, rabbitmqctl_list/3,
rabbitmq_queues/3,
rabbitmq_queues/3, rabbitmq_diagnostics/3,

add_code_path_to_node/2,
add_code_path_to_all_nodes/2,
Expand Down Expand Up @@ -217,6 +217,7 @@ setup_steps() ->
fun rabbit_ct_helpers:ensure_rabbitmqctl_cmd/1,
fun rabbit_ct_helpers:ensure_rabbitmqctl_app/1,
fun rabbit_ct_helpers:ensure_rabbitmq_plugins_cmd/1,
fun rabbit_ct_helpers:ensure_rabbitmq_diagnostics_cmd/1,
fun set_lager_flood_limit/1,
fun start_rabbitmq_nodes/1,
fun share_dist_and_proxy_ports_map/1,
Expand All @@ -227,6 +228,7 @@ setup_steps() ->
fun rabbit_ct_helpers:ensure_rabbitmqctl_cmd/1,
fun rabbit_ct_helpers:load_rabbitmqctl_app/1,
fun rabbit_ct_helpers:ensure_rabbitmq_plugins_cmd/1,
fun rabbit_ct_helpers:ensure_rabbitmq_diagnostics_cmd/1,
fun set_lager_flood_limit/1,
fun start_rabbitmq_nodes/1,
fun share_dist_and_proxy_ports_map/1,
Expand Down Expand Up @@ -1461,6 +1463,21 @@ rabbitmq_queues(Config, Node, Args) ->
Cmd = [RabbitmqQueues, "-n", Nodename | Args],
rabbit_ct_helpers:exec(Cmd, [{env, Env}]).

rabbitmq_diagnostics(Config, Node, Args) ->
Rabbitmqdiagnostics = ?config(rabbitmq_diagnostics_cmd, Config),
NodeConfig = get_node_config(Config, Node),
Nodename = ?config(nodename, NodeConfig),
Env = [
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(Rabbitmqdiagnostics)},
{"RABBITMQ_PID_FILE", ?config(pid_file, NodeConfig)},
{"RABBITMQ_MNESIA_DIR", ?config(data_dir, NodeConfig)},
{"RABBITMQ_PLUGINS_DIR", ?config(plugins_dir, NodeConfig)},
{"RABBITMQ_ENABLED_PLUGINS_FILE",
?config(enabled_plugins_file, NodeConfig)}
],
Cmd = [Rabbitmqdiagnostics, "-n", Nodename | Args],
rabbit_ct_helpers:exec(Cmd, [{env, Env}]).

%% -------------------------------------------------------------------
%% Other helpers.
%% -------------------------------------------------------------------
Expand Down
36 changes: 36 additions & 0 deletions deps/rabbitmq_ct_helpers/src/rabbit_ct_helpers.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
load_rabbitmqctl_app/1,
ensure_rabbitmq_plugins_cmd/1,
ensure_rabbitmq_queues_cmd/1,
ensure_rabbitmq_diagnostics_cmd/1,
redirect_logger_to_ct_logs/1,
init_skip_as_error_flag/1,
start_long_running_testsuite_monitor/1,
Expand Down Expand Up @@ -595,6 +596,41 @@ ensure_rabbitmq_queues_cmd(Config) ->
end
end.

ensure_rabbitmq_diagnostics_cmd(Config) ->
RabbitmqDiagnostics = case get_config(Config, rabbitmq_diagnostics_cmd) of
undefined ->
case os:getenv("RABBITMQ_DIAGNOSTICS") of
false -> find_script(Config, "rabbitmq-diagnostics");
R -> R
end;
R ->
ct:log(?LOW_IMPORTANCE,
"Using rabbitmq-diagnostics from rabbitmq_diagnostics_cmd: ~tp~n", [R]),
R
end,
Error = {skip, "rabbitmq-diagnostics required, " ++
"please set 'rabbitmq_diagnostics_cmd' in ct config"},
case RabbitmqDiagnostics of
false ->
Error;
_ ->
Cmd = [RabbitmqDiagnostics],
Env = [
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(RabbitmqDiagnostics)}
],
case exec(Cmd, [drop_stdout, {env, Env}]) of
{error, 64, _} ->
set_config(Config,
{rabbitmq_diagnostics_cmd,
RabbitmqDiagnostics});
{error, Code, Reason} ->
ct:pal("Exec failed with exit code ~tp: ~tp", [Code, Reason]),
Error;
_ ->
Error
end
end.

ensure_ssl_certs(Config) ->
SrcDir = ?config(rabbitmq_ct_helpers_srcdir, Config),
UniqueDir = io_lib:format(
Expand Down
Loading