diff --git a/consul/client_test.go b/consul/client_test.go index 306b69b102..980080c78c 100644 --- a/consul/client_test.go +++ b/consul/client_test.go @@ -3,6 +3,7 @@ package consul import ( "fmt" "github.com/hashicorp/consul/consul/structs" + "net" "os" "testing" "time" @@ -21,7 +22,10 @@ func testClientDC(t *testing.T, dc string) (string, *Client) { // Adjust the ports p := getPort() config.NodeName = fmt.Sprintf("Node %d", p) - config.RPCAddr = fmt.Sprintf("127.0.0.1:%d", p) + config.RPCAddr = &net.TCPAddr{ + IP: []byte{127, 0, 0, 1}, + Port: p, + } config.SerfLANConfig.MemberlistConfig.BindAddr = "127.0.0.1" config.SerfLANConfig.MemberlistConfig.BindPort = getPort() config.SerfLANConfig.MemberlistConfig.ProbeTimeout = 200 * time.Millisecond diff --git a/consul/server_test.go b/consul/server_test.go index e62d6b9251..3d01e8c5ed 100644 --- a/consul/server_test.go +++ b/consul/server_test.go @@ -39,7 +39,10 @@ func testServerDC(t *testing.T, dc string) (string, *Server) { // Adjust the ports p := getPort() config.NodeName = fmt.Sprintf("Node %d", p) - config.RPCAddr = fmt.Sprintf("127.0.0.1:%d", p) + config.RPCAddr = &net.TCPAddr{ + IP: []byte{127, 0, 0, 1}, + Port: p, + } config.SerfLANConfig.MemberlistConfig.BindAddr = "127.0.0.1" config.SerfLANConfig.MemberlistConfig.BindPort = getPort() config.SerfLANConfig.MemberlistConfig.ProbeTimeout = 200 * time.Millisecond diff --git a/consul/status_endpoint_test.go b/consul/status_endpoint_test.go index ef029db028..683b4bb74d 100644 --- a/consul/status_endpoint_test.go +++ b/consul/status_endpoint_test.go @@ -11,7 +11,7 @@ import ( func rpcClient(t *testing.T, s *Server) *rpc.Client { addr := s.config.RPCAddr - conn, err := net.DialTimeout("tcp", addr, time.Second) + conn, err := net.DialTimeout("tcp", addr.String(), time.Second) if err != nil { t.Fatalf("err: %v", err) }