Fix panic in upstream test if upstream returns with i/o timeout

This commit is contained in:
Eugene Bujak 2018-11-28 14:34:04 +03:00
parent 504aaddc32
commit 58129543de
1 changed files with 2 additions and 2 deletions

View File

@ -167,11 +167,11 @@ func testUpstream(t *testing.T, u Upstream) {
resp, err := u.Exchange(context.Background(), &req) resp, err := u.Exchange(context.Background(), &req)
if err != nil { if err != nil {
t.Errorf("error while making an upstream request: %s", err) t.Fatalf("error while making an upstream request: %s", err)
} }
if len(resp.Answer) != 1 { if len(resp.Answer) != 1 {
t.Errorf("no answer section in the response") t.Fatalf("no answer section in the response")
} }
if answer, ok := resp.Answer[0].(*dns.A); ok { if answer, ok := resp.Answer[0].(*dns.A); ok {
if !test.expected.Equal(answer.A) { if !test.expected.Equal(answer.A) {