Browse Source

Fixing some tests

pull/19/head
Armon Dadgar 11 years ago
parent
commit
c78cc37f0b
  1. 6
      consul/client_test.go
  2. 5
      consul/server_test.go
  3. 2
      consul/status_endpoint_test.go

6
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

5
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

2
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)
}

Loading…
Cancel
Save