From 10622b699524698048ee1d86dfc5be6f8993cce9 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Fri, 12 May 2017 12:13:18 +0200 Subject: [PATCH] test: suppress osx firewall warning macOS displays a firewall warning dialog when an unsigned application is trying to bind to a non-loopback address. This patch updates some test configurations to ensure binding to a loopback address where possible to suppress these warnings. --- command/agent/agent_endpoint_test.go | 2 +- command/agent/agent_test.go | 5 +++++ command/agent/command_test.go | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/command/agent/agent_endpoint_test.go b/command/agent/agent_endpoint_test.go index 0f65c18af..487c3af88 100644 --- a/command/agent/agent_endpoint_test.go +++ b/command/agent/agent_endpoint_test.go @@ -278,7 +278,7 @@ func TestAgent_Reload(t *testing.T) { args := []string{ "-server", - "-advertise", "127.0.0.1", + "-bind", "127.0.0.1", "-data-dir", tmpDir, "-http-port", fmt.Sprintf("%d", conf.Ports.HTTP), "-config-file", tmpFile.Name(), diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index 5787707ef..63b1f117e 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -10,6 +10,7 @@ import ( "os" "path/filepath" "reflect" + "runtime" "strings" "sync/atomic" "testing" @@ -185,6 +186,10 @@ func TestAgent_RPCPing(t *testing.T) { } func TestAgent_CheckSerfBindAddrsSettings(t *testing.T) { + if runtime.GOOS == "darwin" { + t.Skip("skip test on macOS to avoid firewall warning dialog") + } + c := nextConfig() ip, err := externalIP() if err != nil { diff --git a/command/agent/command_test.go b/command/agent/command_test.go index dcb997e71..dbc874875 100644 --- a/command/agent/command_test.go +++ b/command/agent/command_test.go @@ -135,6 +135,7 @@ func TestRetryJoin(t *testing.T) { args := []string{ "-server", + "-bind", agent.config.BindAddr, "-data-dir", tmpDir, "-node", fmt.Sprintf(`"%s"`, conf2.NodeName), "-advertise", agent.config.BindAddr, @@ -310,6 +311,7 @@ func TestRetryJoinFail(t *testing.T) { serfAddr := fmt.Sprintf("%s:%d", conf.BindAddr, conf.Ports.SerfLan) args := []string{ + "-bind", conf.BindAddr, "-data-dir", tmpDir, "-retry-join", serfAddr, "-retry-max", "1", @@ -341,6 +343,7 @@ func TestRetryJoinWanFail(t *testing.T) { args := []string{ "-server", + "-bind", conf.BindAddr, "-data-dir", tmpDir, "-retry-join-wan", serfAddr, "-retry-max-wan", "1",