Skip to content

Commit

Permalink
fqdn: Fix missing IsNil checks in unit tests
Browse files Browse the repository at this point in the history
Fixes: 1121202 ("fqdn: L3-aware L7 DNS policy enforcement")
Signed-off-by: Paul Chaignon <paul@cilium.io>
  • Loading branch information
pchaigno authored and tgraf committed Jun 8, 2020
1 parent 961da39 commit a7cddb0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/fqdn/dnsproxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,14 @@ func (s *DNSProxyTestSuite) TestRejectNonMatchingRefusedResponse(c *C) {

// reject a query with NXDomain
s.proxy.SetRejectReply(option.FQDNProxyDenyWithNameError)
response, _, _ := s.dnsTCPClient.Exchange(request, s.proxy.TCPServer.Listener.Addr().String())
response, _, err := s.dnsTCPClient.Exchange(request, s.proxy.TCPServer.Listener.Addr().String())
c.Assert(err, IsNil, Commentf("DNS request from test client failed when it should succeed"))
c.Assert(response.Rcode, Equals, dns.RcodeNameError, Commentf("DNS request from test client was not rejected when it should be blocked"))

// reject a query with Refused
s.proxy.SetRejectReply(option.FQDNProxyDenyWithRefused)
response, _, _ = s.dnsTCPClient.Exchange(request, s.proxy.TCPServer.Listener.Addr().String())
response, _, err = s.dnsTCPClient.Exchange(request, s.proxy.TCPServer.Listener.Addr().String())
c.Assert(err, IsNil, Commentf("DNS request from test client failed when it should succeed"))
c.Assert(response.Rcode, Equals, dns.RcodeRefused, Commentf("DNS request from test client was not rejected when it should be blocked"))

}
Expand Down

0 comments on commit a7cddb0

Please sign in to comment.