Fix TestStubLookup and TestLookup (#213)
Changes large parts of proxy lookup mechanism. The duplicate zone checking erroneous added a nameserver for each zone we are auth. for, creating to many backend hosts. So even when a host was determined do be Down() we still got an (identical) new one from the list. The Down() and failure checking for upstream hosts had data race in the uh.Fails check - we now use atomic.LoadInt32 for that. Use and debug the test/server.go test servers implementation in the TestStubLookup test to prevent going out to the internet. Also delete the stub cycle test. That test was wrong and did not test what it needed to be testing. Deleted for now.
This commit is contained in:
parent
6d3f9d2193
commit
34ffb2b314
10 changed files with 62 additions and 90 deletions
|
@ -14,19 +14,20 @@ import (
|
|||
)
|
||||
|
||||
func TestMultiLookup(t *testing.T) {
|
||||
etcMulti := *etc
|
||||
etcMulti.Zones = []string{"skydns.test.", "miek.nl."}
|
||||
etcMulti.Next = test.ErrorHandler()
|
||||
etc.Zones = []string{"skydns.test.", "miek.nl."}
|
||||
defer func() { etc.Zones = []string{"skydns.test.", "skydns_extra.test.", "in-addr.arpa."} }()
|
||||
etc.Next = test.ErrorHandler()
|
||||
defer func() { etc.Next = nil }()
|
||||
|
||||
for _, serv := range servicesMulti {
|
||||
set(t, &etcMulti, serv.Key, 0, serv)
|
||||
defer delete(t, &etcMulti, serv.Key)
|
||||
set(t, etc, serv.Key, 0, serv)
|
||||
defer delete(t, etc, serv.Key)
|
||||
}
|
||||
for _, tc := range dnsTestCasesMulti {
|
||||
m := tc.Msg()
|
||||
|
||||
rec := middleware.NewResponseRecorder(&test.ResponseWriter{})
|
||||
_, err := etcMulti.ServeDNS(ctxt, rec, m)
|
||||
_, err := etc.ServeDNS(ctxt, rec, m)
|
||||
if err != nil {
|
||||
t.Errorf("expected no error, got %v\n", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue