Testing Raft advertise addr

pull/19/head
Armon Dadgar 11 years ago
parent c721f0c43a
commit 3f6f9cc33a

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

@ -3,6 +3,7 @@ package consul
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net"
"os" "os"
"testing" "testing"
"time" "time"
@ -68,6 +69,16 @@ func TestServer_StartStop(t *testing.T) {
config := DefaultConfig() config := DefaultConfig()
config.DataDir = dir 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) server, err := NewServer(config)
if err != nil { if err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)

Loading…
Cancel
Save