From ea320f5ee35fda7744e86a1bd77b948e534eeb1e Mon Sep 17 00:00:00 2001 From: Eugene Bujak Date: Tue, 25 Sep 2018 19:12:32 +0300 Subject: [PATCH] Fix test failures introduced by previous commit afd1fe21f69e15381a898a11b99ad1ab6a407402. --- coredns_plugin/coredns_plugin_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/coredns_plugin/coredns_plugin_test.go b/coredns_plugin/coredns_plugin_test.go index da4f5cd4..5c309269 100644 --- a/coredns_plugin/coredns_plugin_test.go +++ b/coredns_plugin/coredns_plugin_test.go @@ -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) }