Commit 95477fd2 authored by Miek Gieben's avatar Miek Gieben

Dont crash on tests with etcd running

parent a4bf01e1
......@@ -30,6 +30,9 @@ func (e Etcd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
zone := middleware.Zones(e.Zones).Matches(state.Name())
if zone == "" {
if e.Next == nil {
return dns.RcodeServerFailure, nil
}
return e.Next.ServeDNS(ctx, w, r)
}
......
......@@ -32,6 +32,10 @@ func TestStubLookup(t *testing.T) {
continue
}
resp := rec.Msg()
if resp == nil {
// etcd not running?
continue
}
sort.Sort(test.RRSet(resp.Answer))
sort.Sort(test.RRSet(resp.Ns))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment