diff --git a/app/resolver_test.go b/app/resolver_test.go index 24aba51008..6e47fe6b2f 100644 --- a/app/resolver_test.go +++ b/app/resolver_test.go @@ -15,6 +15,7 @@ func TestResolver(t *testing.T) { defer func() { tick = oldTick }() c := make(chan time.Time) tick = func(_ time.Duration) <-chan time.Time { return c } + oldLookupIP := lookupIP defer func() { lookupIP = oldLookupIP }() ips := map[string][]net.IP{} @@ -32,24 +33,17 @@ func TestResolver(t *testing.T) { adds := make(chan string) add := func(s string) { adds <- s } - r := newStaticResolver([]string{"symbolic.name" + port}, add) - - //c <- time.Now() // trigger initial resolve, with no endpoints - //select { - //case <-time.After(time.Millisecond): - //case s := <-adds: - // t.Errorf("got unexpected add: %q", s) - //} + r := newStaticResolver([]string{"symbolic.name" + port, "namewithnoport", ip1 + port, ip2}, add) assertAdd := func(want string) { + _, _, line, _ := runtime.Caller(1) select { case have := <-adds: if want != have { - _, _, line, _ := runtime.Caller(1) t.Errorf("line %d: want %q, have %q", line, want, have) } case <-time.After(time.Millisecond): - t.Fatal("didn't get add in time") + t.Fatalf("line %d: didn't get add in time", line) } }