Merge pull request #36 in DNS/adguard-dns from bugfix/343 to master

* commit 'ea320f5ee35fda7744e86a1bd77b948e534eeb1e':
  Fix test failures introduced by previous commit afd1fe21f6.
This commit is contained in:
Eugene Bujak 2018-09-25 19:14:59 +03:00
commit dd8396cec1
1 changed files with 6 additions and 1 deletions

View File

@ -126,7 +126,12 @@ func TestEtcHostsFilter(t *testing.T) {
if rcode != rrw.Rcode {
t.Fatalf("ServeDNS return value for host %s has rcode %d that does not match captured rcode %d", testcase.host, rcode, rrw.Rcode)
}
filtered := rcode == dns.RcodeNameError
A, ok := rrw.Msg.Answer[0].(*dns.A)
if !ok {
t.Fatalf("Host %s expected to have result A", testcase.host)
}
ip := net.IPv4(127, 0, 0, 1)
filtered := ip.Equal(A.A)
if testcase.filtered && testcase.filtered != filtered {
t.Fatalf("Host %s expected to be filtered, instead it is not filtered", testcase.host)
}