From 6941e10a28cfb556a809d5965939c0d512016d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Fri, 29 Nov 2024 16:30:01 +0100 Subject: [PATCH 1/3] rabbitmq_peer_discovery_consul: Set `bind_addr` to 127.0.0.1 in test config [Why] The test configuration was querying a network interface IP address based on its name. However, the name, "eth0", is very specific to Linux. This broke the test on other systems. [How] We still have to set an explicit `bind_addr` because Consul refuses to start if the host has multiple private IPv4 addresses, as it is the case in CI. Therefore, we hard-code 127.0.0.1 as the IPv4 address to use because it has a great chance to exist about anywhere. --- .../test/system_SUITE_data/consul.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/rabbitmq_peer_discovery_consul/test/system_SUITE_data/consul.hcl b/deps/rabbitmq_peer_discovery_consul/test/system_SUITE_data/consul.hcl index 4a850633c427..9374b7b3123a 100644 --- a/deps/rabbitmq_peer_discovery_consul/test/system_SUITE_data/consul.hcl +++ b/deps/rabbitmq_peer_discovery_consul/test/system_SUITE_data/consul.hcl @@ -23,7 +23,7 @@ connect { # Addresses and ports client_addr = "0.0.0.0" -bind_addr = "{{ GetInterfaceIP \"eth0\" }}" +bind_addr = "127.0.0.1" addresses { grpc = "0.0.0.0" From f4d61d2775035fddf373f02053415a873e462cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Fri, 29 Nov 2024 17:19:38 +0100 Subject: [PATCH 2/3] rabbitmq_peer_discovery_consul: Configure Consul test instance log file --- deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl b/deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl index 99080862509c..68e9346d79e1 100644 --- a/deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl +++ b/deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl @@ -197,7 +197,11 @@ start_consul(Config) -> ct:pal("Starting Consul daemon"), ConsulBin = ?config(consul_bin, Config), ConsulConfDir = ?config(consul_conf_dir, Config), - Cmd = [ConsulBin, "agent", "-config-dir", ConsulConfDir], + PrivDir = ?config(priv_dir, Config), + LogFile = filename:join(PrivDir, "consul.log"), + Cmd = [ConsulBin, "agent", + "-config-dir", ConsulConfDir, + "-log-file", LogFile], ConsulPid = spawn(fun() -> rabbit_ct_helpers:exec(Cmd) end), rabbit_ct_helpers:set_config(Config, {consul_pid, ConsulPid}). From b03f0bd07de264e517ea9449c4015d80323da807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Mon, 2 Dec 2024 10:20:59 +0100 Subject: [PATCH 3/3] rabbitmq_peer_discovery_consul: Log output from Consul daemon [Why] It helps diagnose any startup issues. Typically a problem with the configuration where the log file is not yet created. --- .../test/system_SUITE.erl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl b/deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl index 68e9346d79e1..194d6b2e4132 100644 --- a/deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl +++ b/deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl @@ -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) ->