Skip to content

Commit 69b83bf

Browse files
authored
Merge pull request #12883 from rabbitmq/mergify/bp/v4.0.x/pr-12858
rabbitmq_peer_discovery_consul: Set `bind_addr` to 127.0.0.1 in test config (backport #12858)
2 parents ecc6481 + d4fda59 commit 69b83bf

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,24 @@ start_consul(Config) ->
197197
ct:pal("Starting Consul daemon"),
198198
ConsulBin = ?config(consul_bin, Config),
199199
ConsulConfDir = ?config(consul_conf_dir, Config),
200-
Cmd = [ConsulBin, "agent", "-config-dir", ConsulConfDir],
201-
ConsulPid = spawn(fun() -> rabbit_ct_helpers:exec(Cmd) end),
200+
PrivDir = ?config(priv_dir, Config),
201+
LogFile = filename:join(PrivDir, "consul.log"),
202+
Cmd = [ConsulBin, "agent",
203+
"-config-dir", ConsulConfDir,
204+
"-log-file", LogFile],
205+
ConsulPid = spawn(fun() -> do_start_consul(Cmd) end),
202206
rabbit_ct_helpers:set_config(Config, {consul_pid, ConsulPid}).
203207

208+
do_start_consul(Cmd) ->
209+
case rabbit_ct_helpers:exec(Cmd) of
210+
{ok, Stdout} ->
211+
ct:pal("Consul daemon exited:~n~s", [Stdout]);
212+
{error, Reason, Stdout} ->
213+
ct:pal(
214+
"Consul daemon exited with error ~0p:~n~s",
215+
[Reason, Stdout])
216+
end.
217+
204218
stop_consul(Config) ->
205219
case rabbit_ct_helpers:get_config(Config, consul_pid) of
206220
ConsulPid when is_pid(ConsulPid) ->

deps/rabbitmq_peer_discovery_consul/test/system_SUITE_data/consul.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ connect {
2323

2424
# Addresses and ports
2525
client_addr = "0.0.0.0"
26-
bind_addr = "{{ GetInterfaceIP \"eth0\" }}"
26+
bind_addr = "127.0.0.1"
2727

2828
addresses {
2929
grpc = "0.0.0.0"

0 commit comments

Comments
 (0)