Browse Source

Testing Raft advertise addr

pull/19/head
Armon Dadgar 11 years ago
parent
commit
3f6f9cc33a
  1. 3
      consul/config.go
  2. 11
      consul/server_test.go

3
consul/config.go

@ -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

11
consul/server_test.go

@ -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)

Loading…
Cancel
Save