|
|
@ -2,6 +2,7 @@ package consul
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/serf/serf"
|
|
|
|
"github.com/hashicorp/serf/serf"
|
|
|
|
|
|
|
|
"net"
|
|
|
|
"regexp"
|
|
|
|
"regexp"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -36,6 +37,7 @@ func TestIsPrivateIP(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
func TestIsConsulServer(t *testing.T) {
|
|
|
|
func TestIsConsulServer(t *testing.T) {
|
|
|
|
m := serf.Member{
|
|
|
|
m := serf.Member{
|
|
|
|
|
|
|
|
Addr: net.IP([]byte{127, 0, 0, 1}),
|
|
|
|
Tags: map[string]string{
|
|
|
|
Tags: map[string]string{
|
|
|
|
"role": "consul",
|
|
|
|
"role": "consul",
|
|
|
|
"dc": "east-aws",
|
|
|
|
"dc": "east-aws",
|
|
|
@ -54,6 +56,9 @@ func TestIsConsulServer(t *testing.T) {
|
|
|
|
if !valid || !parts.Bootstrap {
|
|
|
|
if !valid || !parts.Bootstrap {
|
|
|
|
t.Fatalf("expected bootstrap")
|
|
|
|
t.Fatalf("expected bootstrap")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if parts.Addr.String() != "127.0.0.1:10000" {
|
|
|
|
|
|
|
|
t.Fatalf("bad addr: %v", parts.Addr)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestIsConsulNode(t *testing.T) {
|
|
|
|
func TestIsConsulNode(t *testing.T) {
|
|
|
|