Skip to content

Commit

Permalink
rabbitmq_peer_discovery_consul: Log output from Consul daemon
Browse files Browse the repository at this point in the history
[Why]
It helps diagnose any startup issues. Typically a problem with the
configuration where the log file is not yet created.
  • Loading branch information
dumbbell committed Dec 2, 2024
1 parent 8b8ef74 commit 5ba26fc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,19 @@ start_consul(Config) ->
Cmd = [ConsulBin, "agent",
"-config-dir", ConsulConfDir,
"-log-file", LogFile],
ConsulPid = spawn(fun() -> rabbit_ct_helpers:exec(Cmd) end),
ConsulPid = spawn(fun() -> do_start_consul(Cmd) end),
rabbit_ct_helpers:set_config(Config, {consul_pid, ConsulPid}).

do_start_consul(Cmd) ->
case rabbit_ct_helpers:exec(Cmd) of
{ok, Stdout} ->
ct:pal("Consul daemon exited:~n~s", [Stdout]);
{error, Reason, Stdout} ->
ct:pal(
"Consul daemon exited with error ~0p:~n~s",
[Reason, Stdout])
end.

stop_consul(Config) ->
case rabbit_ct_helpers:get_config(Config, consul_pid) of
ConsulPid when is_pid(ConsulPid) ->
Expand Down

0 comments on commit 5ba26fc

Please sign in to comment.