Skip to content

Commit

Permalink
migrate snooper tests to use new local DNS server (#20615)
Browse files Browse the repository at this point in the history
* Update DNS tests to use a local DNS server

Most of our DNS tests were hitting google DNS (8.8.8.8). This PR runs a
singleton DNS server which responds with canned responses to domains
used in our tests.

The test server creates a 'dummy' interface on 10.10.10.10 and binds on
TCP/UDP port 53. The server code is all in the testutil/testdns package.

This should avoid any packet loss causing test flakiness.

The one exception is TestTracerSuite/TestDNSStatsWithNAT which still
uses NAT. I couldn't figure out how to get NAT working to a dummy
interface.

* Revert tim

* Remove testing file

* Fix imports?

* Fixup imports

* Fix linting

* Fix golang-ci

* Fix test tag

* Fix license

* Restore 8.8.8.8 in windows

* Revert "Restore 8.8.8.8 in windows"

This reverts commit cefcfa2.

* Restore local

* initial stab

* fixed TestDNSNestedCNAME

* fix TestDNSOverIPv6

* all snooper tests passing with new test server

* use dummy server to get free port

* local udp server to get random port

* tcp + udp for non standard port

* update tracer tests

* added comment for linter

* custom server for non-53, remove globals

* updated local dns server to use global errors for each protocol

* linter

---------

Co-authored-by: Lee Avital <[email protected]>
  • Loading branch information
akarpz and leeavital authored Nov 7, 2023
1 parent 243f832 commit edfde91
Show file tree
Hide file tree
Showing 6 changed files with 219 additions and 129 deletions.
2 changes: 2 additions & 0 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,7 @@ core,github.com/mdlayher/netlink/nlenc,MIT,Copyright (C) 2016-2022 Matt Layher
core,github.com/mdlayher/socket,MIT,Copyright (C) 2021 Matt Layher
core,github.com/mholt/archiver/v3,MIT,Copyright (c) 2016 Matthew Holt
core,github.com/microsoft/go-rustaudit,MIT,Copyright (c) Microsoft Corporation
core,github.com/miekg/dns,BSD-3-Clause,"Alex A. Skinner | Alex Sergeyev | Andrew Tunnell-Jones | Ask Bjørn Hansen | Copyright (c) 2009, The Go Authors. Extensions copyright (c) 2011, Miek Gieben | Copyright 2009 The Go Authors. All rights reserved. Use of this source code | Copyright 2011 Miek Gieben. All rights reserved. Use of this source code is | Copyright 2014 CloudFlare. All rights reserved. Use of this source code is | Dave Cheney | Dusty Wilson | James Hartig | Marek Majkowski | Miek Gieben <[email protected]> | Omri Bahumi | Peter van Dijk | copyright (c) 2011 Miek Gieben"
core,github.com/mitchellh/copystructure,MIT,Copyright (c) 2014 Mitchell Hashimoto
core,github.com/mitchellh/go-homedir,MIT,Copyright (c) 2013 Mitchell Hashimoto
core,github.com/mitchellh/hashstructure/v2,MIT,Copyright (c) 2016 Mitchell Hashimoto
Expand Down Expand Up @@ -1850,6 +1851,7 @@ core,golang.org/x/net/internal/socket,BSD-3-Clause,Copyright (c) 2009 The Go Aut
core,golang.org/x/net/internal/socks,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved
core,golang.org/x/net/internal/timeseries,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved
core,golang.org/x/net/ipv4,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved
core,golang.org/x/net/ipv6,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved
core,golang.org/x/net/proxy,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved
core,golang.org/x/net/trace,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved
core,golang.org/x/net/websocket,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved
Expand Down
Loading

0 comments on commit edfde91

Please sign in to comment.