mirror of https://github.com/hashicorp/consul
Changing the Join interfaces to match Serf
parent
f33a9c1d2d
commit
b468519698
|
@ -55,8 +55,8 @@ func TestCatalogRegister_ForwardLeader(t *testing.T) {
|
|||
|
||||
// Try to join
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfLANConfig.MemberlistConfig.Port)
|
||||
if err := s2.JoinLAN(addr); err != nil {
|
||||
s1.config.SerfLANConfig.MemberlistConfig.BindPort)
|
||||
if _, err := s2.JoinLAN([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
|
@ -98,8 +98,8 @@ func TestCatalogRegister_ForwardDC(t *testing.T) {
|
|||
|
||||
// Try to join
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfWANConfig.MemberlistConfig.Port)
|
||||
if err := s2.JoinWAN(addr); err != nil {
|
||||
s1.config.SerfWANConfig.MemberlistConfig.BindPort)
|
||||
if _, err := s2.JoinWAN([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
|
@ -159,8 +159,8 @@ func TestCatalogListDatacenters(t *testing.T) {
|
|||
|
||||
// Try to join
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfWANConfig.MemberlistConfig.Port)
|
||||
if err := s2.JoinWAN(addr); err != nil {
|
||||
s1.config.SerfWANConfig.MemberlistConfig.BindPort)
|
||||
if _, err := s2.JoinWAN([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
|
|
@ -139,9 +139,8 @@ func (c *Client) Leave() error {
|
|||
// JoinLAN is used to have Consul client join the inner-DC pool
|
||||
// The target address should be another node inside the DC
|
||||
// listening on the Serf LAN address
|
||||
func (c *Client) JoinLAN(addr string) error {
|
||||
_, err := c.serf.Join([]string{addr}, false)
|
||||
return err
|
||||
func (c *Client) JoinLAN(addrs []string) (int, error) {
|
||||
return c.serf.Join(addrs, false)
|
||||
}
|
||||
|
||||
// LANMembers is used to return the members of the LAN cluster
|
||||
|
|
|
@ -23,7 +23,7 @@ func testClientDC(t *testing.T, dc string) (string, *Client) {
|
|||
config.NodeName = fmt.Sprintf("Node %d", p)
|
||||
config.RPCAddr = fmt.Sprintf("127.0.0.1:%d", p)
|
||||
config.SerfLANConfig.MemberlistConfig.BindAddr = "127.0.0.1"
|
||||
config.SerfLANConfig.MemberlistConfig.Port = getPort()
|
||||
config.SerfLANConfig.MemberlistConfig.BindPort = getPort()
|
||||
config.SerfLANConfig.MemberlistConfig.ProbeTimeout = 200 * time.Millisecond
|
||||
config.SerfLANConfig.MemberlistConfig.ProbeInterval = time.Second
|
||||
config.SerfLANConfig.MemberlistConfig.GossipInterval = 100 * time.Millisecond
|
||||
|
@ -55,8 +55,8 @@ func TestClient_JoinLAN(t *testing.T) {
|
|||
|
||||
// Try to join
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfLANConfig.MemberlistConfig.Port)
|
||||
if err := c1.JoinLAN(addr); err != nil {
|
||||
s1.config.SerfLANConfig.MemberlistConfig.BindPort)
|
||||
if _, err := c1.JoinLAN([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,8 @@ func TestClient_RPC(t *testing.T) {
|
|||
|
||||
// Try to join
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfLANConfig.MemberlistConfig.Port)
|
||||
if err := c1.JoinLAN(addr); err != nil {
|
||||
s1.config.SerfLANConfig.MemberlistConfig.BindPort)
|
||||
if _, err := c1.JoinLAN([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
|
|
|
@ -346,17 +346,15 @@ AFTER_LEAVE:
|
|||
// JoinLAN is used to have Consul join the inner-DC pool
|
||||
// The target address should be another node inside the DC
|
||||
// listening on the Serf LAN address
|
||||
func (s *Server) JoinLAN(addr string) error {
|
||||
_, err := s.serfLAN.Join([]string{addr}, false)
|
||||
return err
|
||||
func (s *Server) JoinLAN(addrs []string) (int, error) {
|
||||
return s.serfLAN.Join(addrs, false)
|
||||
}
|
||||
|
||||
// JoinWAN is used to have Consul join the cross-WAN Consul ring
|
||||
// The target address should be another node listening on the
|
||||
// Serf WAN address
|
||||
func (s *Server) JoinWAN(addr string) error {
|
||||
_, err := s.serfWAN.Join([]string{addr}, false)
|
||||
return err
|
||||
func (s *Server) JoinWAN(addrs []string) (int, error) {
|
||||
return s.serfWAN.Join(addrs, false)
|
||||
}
|
||||
|
||||
// LANMembers is used to return the members of the LAN cluster
|
||||
|
|
|
@ -40,13 +40,13 @@ func testServerDC(t *testing.T, dc string) (string, *Server) {
|
|||
config.NodeName = fmt.Sprintf("Node %d", p)
|
||||
config.RPCAddr = fmt.Sprintf("127.0.0.1:%d", p)
|
||||
config.SerfLANConfig.MemberlistConfig.BindAddr = "127.0.0.1"
|
||||
config.SerfLANConfig.MemberlistConfig.Port = getPort()
|
||||
config.SerfLANConfig.MemberlistConfig.BindPort = getPort()
|
||||
config.SerfLANConfig.MemberlistConfig.ProbeTimeout = 200 * time.Millisecond
|
||||
config.SerfLANConfig.MemberlistConfig.ProbeInterval = time.Second
|
||||
config.SerfLANConfig.MemberlistConfig.GossipInterval = 100 * time.Millisecond
|
||||
|
||||
config.SerfWANConfig.MemberlistConfig.BindAddr = "127.0.0.1"
|
||||
config.SerfWANConfig.MemberlistConfig.Port = getPort()
|
||||
config.SerfWANConfig.MemberlistConfig.BindPort = getPort()
|
||||
config.SerfWANConfig.MemberlistConfig.ProbeTimeout = 200 * time.Millisecond
|
||||
config.SerfWANConfig.MemberlistConfig.ProbeInterval = time.Second
|
||||
config.SerfWANConfig.MemberlistConfig.GossipInterval = 100 * time.Millisecond
|
||||
|
@ -94,8 +94,8 @@ func TestServer_JoinLAN(t *testing.T) {
|
|||
|
||||
// Try to join
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfLANConfig.MemberlistConfig.Port)
|
||||
if err := s2.JoinLAN(addr); err != nil {
|
||||
s1.config.SerfLANConfig.MemberlistConfig.BindPort)
|
||||
if _, err := s2.JoinLAN([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
|
@ -120,8 +120,8 @@ func TestServer_JoinWAN(t *testing.T) {
|
|||
|
||||
// Try to join
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfWANConfig.MemberlistConfig.Port)
|
||||
if err := s2.JoinWAN(addr); err != nil {
|
||||
s1.config.SerfWANConfig.MemberlistConfig.BindPort)
|
||||
if _, err := s2.JoinWAN([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
|
@ -157,8 +157,8 @@ func TestServer_Leave(t *testing.T) {
|
|||
|
||||
// Try to join
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfLANConfig.MemberlistConfig.Port)
|
||||
if err := s2.JoinLAN(addr); err != nil {
|
||||
s1.config.SerfLANConfig.MemberlistConfig.BindPort)
|
||||
if _, err := s2.JoinLAN([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue