Testing Raft advertise addr
This commit is contained in:
parent
f7eb948ae1
commit
7f2feeb7eb
|
@ -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
|
||||
|
|
|
@ -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…
Reference in New Issue