Embedded NATS Broker (#1110)

* if the address is produced by a default route don't hash it

* embedded nats

* fix url parsing

* don't override help

* add ready flag
This commit is contained in:
Asim Aslam
2020-01-14 13:23:16 +00:00
committed by GitHub
parent b699d969e4
commit 1d311ab457
10 changed files with 308 additions and 41 deletions

View File

@@ -5,6 +5,26 @@ import (
"testing"
)
func TestIsLocal(t *testing.T) {
testData := []struct {
addr string
expect bool
}{
{"localhost", true},
{"localhost:8080", true},
{"127.0.0.1", true},
{"127.0.0.1:1001", true},
{"80.1.1.1", false},
}
for _, d := range testData {
res := IsLocal(d.addr)
if res != d.expect {
t.Fatalf("expected %t got %t", d.expect, res)
}
}
}
func TestExtractor(t *testing.T) {
testData := []struct {
addr string