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.
This commit is contained in:
Frank Schroeder 2017-05-12 12:13:18 +02:00 committed by Frank Schröder
parent 3522a41bad
commit 98f6e3b7c5
3 changed files with 9 additions and 1 deletions

View File

@ -278,7 +278,7 @@ func TestAgent_Reload(t *testing.T) {
args := []string{ args := []string{
"-server", "-server",
"-advertise", "127.0.0.1", "-bind", "127.0.0.1",
"-data-dir", tmpDir, "-data-dir", tmpDir,
"-http-port", fmt.Sprintf("%d", conf.Ports.HTTP), "-http-port", fmt.Sprintf("%d", conf.Ports.HTTP),
"-config-file", tmpFile.Name(), "-config-file", tmpFile.Name(),

View File

@ -10,6 +10,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"reflect" "reflect"
"runtime"
"strings" "strings"
"sync/atomic" "sync/atomic"
"testing" "testing"
@ -185,6 +186,10 @@ func TestAgent_RPCPing(t *testing.T) {
} }
func TestAgent_CheckSerfBindAddrsSettings(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() c := nextConfig()
ip, err := externalIP() ip, err := externalIP()
if err != nil { if err != nil {

View File

@ -135,6 +135,7 @@ func TestRetryJoin(t *testing.T) {
args := []string{ args := []string{
"-server", "-server",
"-bind", agent.config.BindAddr,
"-data-dir", tmpDir, "-data-dir", tmpDir,
"-node", fmt.Sprintf(`"%s"`, conf2.NodeName), "-node", fmt.Sprintf(`"%s"`, conf2.NodeName),
"-advertise", agent.config.BindAddr, "-advertise", agent.config.BindAddr,
@ -310,6 +311,7 @@ func TestRetryJoinFail(t *testing.T) {
serfAddr := fmt.Sprintf("%s:%d", conf.BindAddr, conf.Ports.SerfLan) serfAddr := fmt.Sprintf("%s:%d", conf.BindAddr, conf.Ports.SerfLan)
args := []string{ args := []string{
"-bind", conf.BindAddr,
"-data-dir", tmpDir, "-data-dir", tmpDir,
"-retry-join", serfAddr, "-retry-join", serfAddr,
"-retry-max", "1", "-retry-max", "1",
@ -341,6 +343,7 @@ func TestRetryJoinWanFail(t *testing.T) {
args := []string{ args := []string{
"-server", "-server",
"-bind", conf.BindAddr,
"-data-dir", tmpDir, "-data-dir", tmpDir,
"-retry-join-wan", serfAddr, "-retry-join-wan", serfAddr,
"-retry-max-wan", "1", "-retry-max-wan", "1",