mirror of https://github.com/hashicorp/consul
Fixing some tests
parent
93dac80a86
commit
c78cc37f0b
|
@ -3,6 +3,7 @@ package consul
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/hashicorp/consul/consul/structs"
|
"github.com/hashicorp/consul/consul/structs"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -21,7 +22,10 @@ func testClientDC(t *testing.T, dc string) (string, *Client) {
|
||||||
// Adjust the ports
|
// Adjust the ports
|
||||||
p := getPort()
|
p := getPort()
|
||||||
config.NodeName = fmt.Sprintf("Node %d", p)
|
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.BindAddr = "127.0.0.1"
|
||||||
config.SerfLANConfig.MemberlistConfig.BindPort = getPort()
|
config.SerfLANConfig.MemberlistConfig.BindPort = getPort()
|
||||||
config.SerfLANConfig.MemberlistConfig.ProbeTimeout = 200 * time.Millisecond
|
config.SerfLANConfig.MemberlistConfig.ProbeTimeout = 200 * time.Millisecond
|
||||||
|
|
|
@ -39,7 +39,10 @@ func testServerDC(t *testing.T, dc string) (string, *Server) {
|
||||||
// Adjust the ports
|
// Adjust the ports
|
||||||
p := getPort()
|
p := getPort()
|
||||||
config.NodeName = fmt.Sprintf("Node %d", p)
|
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.BindAddr = "127.0.0.1"
|
||||||
config.SerfLANConfig.MemberlistConfig.BindPort = getPort()
|
config.SerfLANConfig.MemberlistConfig.BindPort = getPort()
|
||||||
config.SerfLANConfig.MemberlistConfig.ProbeTimeout = 200 * time.Millisecond
|
config.SerfLANConfig.MemberlistConfig.ProbeTimeout = 200 * time.Millisecond
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func rpcClient(t *testing.T, s *Server) *rpc.Client {
|
func rpcClient(t *testing.T, s *Server) *rpc.Client {
|
||||||
addr := s.config.RPCAddr
|
addr := s.config.RPCAddr
|
||||||
conn, err := net.DialTimeout("tcp", addr, time.Second)
|
conn, err := net.DialTimeout("tcp", addr.String(), time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue