Testing Raft advertise addr

This commit is contained in:
Armon Dadgar 2013-12-31 15:44:27 -08:00
parent f7eb948ae1
commit 7f2feeb7eb
2 changed files with 12 additions and 2 deletions

View File

@ -12,7 +12,6 @@ import (
const (
DefaultDC = "dc1"
DefaultRPCAddr = "0.0.0.0:8300"
DefaultRPCPort = 8000
DefaultLANSerfPort = 8301
DefaultWANSerfPort = 8302
)
@ -44,7 +43,7 @@ type Config struct {
// the RPC endpoint. This can differ from the RPC address, if for example
// the RPCAddr is unspecified "0.0.0.0:8300", but this address must be
// reachable
RPCAdvertise net.Addr
RPCAdvertise *net.TCPAddr
// SerfLANConfig is the configuration for the intra-dc serf
SerfLANConfig *serf.Config

View File

@ -3,6 +3,7 @@ package consul
import (
"fmt"
"io/ioutil"
"net"
"os"
"testing"
"time"
@ -68,6 +69,16 @@ func TestServer_StartStop(t *testing.T) {
config := DefaultConfig()
config.DataDir = dir
private, err := GetPrivateIP()
if err != nil {
t.Fatalf("err: %v", err)
}
config.RPCAdvertise = &net.TCPAddr{
IP: private.IP,
Port: 8300,
}
server, err := NewServer(config)
if err != nil {
t.Fatalf("err: %v", err)