summaryrefslogtreecommitdiff
path: root/src/net/dnsclient_unix_test.go
Commit message (Collapse)AuthorAgeFilesLines
* net: add timeout to DNS requests sent by TestSpecialDomainNameMichael Munday2016-01-191-1/+1
| | | | | | | | | | | | | The timeout means that TestSpecialDomainName will not hang if the DNS server does not respond to the request. Fixes #13939 Change-Id: I46e30bbd3c11b6c560656134e704331cf6f8af3f Reviewed-on: https://go-review.googlesource.com/18661 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: fix race in testBrad Fitzpatrick2015-12-171-2/+8
| | | | | | | | | Fixes race builders, broken in https://golang.org/cl/16953 Change-Id: Id61171672b69d0ca412de4b44bf2c598fe557906 Reviewed-on: https://go-review.googlesource.com/17936 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
* net: prefer error for original name on lookupsDan Peterson2015-12-171-0/+79
| | | | | | | | | | | | | | | | | | | | | With certain names and search domain configurations the returned error would be one encountered while querying a generated name instead of the original name. This caused confusion when a manual check of the same name produced different results. Now prefer errors encountered for the original name. Also makes the low-level DNS connection plumbing swappable in tests enabling tighter control over responses without relying on the network. Fixes #12712 Updates #13295 Change-Id: I780d628a762006bb11899caf20b5f97b462a717f Reviewed-on: https://go-review.googlesource.com/16953 Reviewed-by: Russ Cox <rsc@golang.org>
* net: fix failing TestGoLookupIPOrderFallbackToFileBenjamin Prosnitz2015-12-031-1/+5
| | | | | | | Change-Id: I17ef4e221e5cd0fb8dc553785248ccac59380c6f Reviewed-on: https://go-review.googlesource.com/17321 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* net: fall back to hosts file if DNS lookup fails, despite orderBenjamin Prosnitz2015-12-021-0/+42
| | | | | | | | | | Fixes #13090 Change-Id: I5612d792dabdff89bd0cec57dc2cacf9be7ebf64 Reviewed-on: https://go-review.googlesource.com/16341 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: don't return DNS query results including the second best records ↵Mikio Hara2015-07-281-0/+154
| | | | | | | | | | | | | | | | | | | unconditionally This change prevents DNS query results using domain search list overtaking results not using the list unconditionally, which only happens when using builtin DNS stub resolver. The previous internal lookup function lookup is split into lookup and goLookupIPOrder for iteration over a set of names: FQDN or absolute FQDN, with domain label suffixes in search list, without domain label suffixes, and for concurrent A and AAAA record queries. Fixes #11081. Change-Id: I9ff0640f69276e372d97e709b149ed5b153e8601 Reviewed-on: https://go-review.googlesource.com/10836 Reviewed-by: Russ Cox <rsc@golang.org>
* net: clean up builtin DNS stub resolver, fix testsMikio Hara2015-07-131-85/+110
| | | | | | | | | | | | | | | This change does clean up as preparation for fixing #11081. - renames cfg to resolvConf for clarification - adds a new type resolverConfig and its methods: init, update, tryAcquireSema, releaseSema for mutual exclusion of resolv.conf data - deflakes, simplifies tests for resolv.conf data; previously the tests sometimes left some garbage in the data Change-Id: I277ced853fddc3791dde40ab54dbd5c78114b78c Reviewed-on: https://go-review.googlesource.com/10931 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* net: redo resolv.conf recheck implementationAlex A Skinner2015-05-151-29/+9
| | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation spawned an extra goroutine to handle rechecking resolv.conf for changes. This change eliminates the extra goroutine, and has rechecking done as part of a lookup. A side effect of this change is that the first lookup after a resolv.conf change will now succeed, whereas previously it would have failed. It also fixes rechecking logic to ignore resolv.conf parsing errors as it should. Fixes #8652 Fixes #10576 Fixes #10649 Fixes #10650 Fixes #10845 Change-Id: I502b587c445fa8eca5207ca4f2c8ec8c339fec7f Reviewed-on: https://go-review.googlesource.com/9991 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: simplify sync.Once calls in testsMikio Hara2015-05-141-3/+3
| | | | | | Change-Id: I0c2e1a4a8261887a696e585dda46e72d691191e0 Reviewed-on: https://go-review.googlesource.com/10070 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: align temporary file, directory names in testsMikio Hara2015-05-071-1/+1
| | | | | | | | Also adds missing temporary file deletion. Change-Id: Ia644b0898022e05d2f5232af38f51d55e40c6fb5 Reviewed-on: https://go-review.googlesource.com/9772 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: simplify error messages in testsMikio Hara2015-05-061-9/+8
| | | | | | | | | | | | | This change simplifies unnecessarily redundant error messages in tests. There's no need to worry any more because package APIs now return consistent, self-descriptive error values. Alos renames ambiguous test functions and makes use of test tables. Change-Id: I7b61027607c4ae2a3cf605d08d58cf449fa27eb2 Reviewed-on: https://go-review.googlesource.com/9662 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
* net: make go DNS use localhost if resolv.conf is missing or emptyAlex A Skinner2015-04-301-17/+24
| | | | | | | | | | | | | | | Per resolv.conf man page, "If this file does not exist, only the name server on the local machine will be queried." This behavior also occurs if file is present but unreadable, or if no nameservers are listed. Fixes #10566 Change-Id: Id5716da0eae534d5ebfafea111bbc657f302e307 Reviewed-on: https://go-review.googlesource.com/9380 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: fix data race in benchmarksMikio Hara2015-04-011-6/+3
| | | | | | | | Fixes #10307. Change-Id: If70f36a6f1c4e465a47a0bc4d38b318424111106 Reviewed-on: https://go-review.googlesource.com/8330 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: add socket system call hooks for testingMikio Hara2015-03-311-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds socket system call hooks to existing test cases for simulating a bit complicated network conditions to help making timeout and dual IP stack test cases work more properly in followup changes. Also test cases print debugging information in non-short mode like the following: Leaked goroutines: net.TestWriteTimeout.func2(0xc20802a5a0, 0xc20801d000, 0x1000, 0x1000, 0xc2081d2ae0) /go/src/net/timeout_test.go:170 +0x98 created by net.TestWriteTimeout /go/src/net/timeout_test.go:173 +0x745 net.runDatagramPacketConnServer(0xc2080730e0, 0x2bd270, 0x3, 0x2c1770, 0xb, 0xc2081d2ba0, 0xc2081d2c00) /go/src/net/server_test.go:398 +0x667 created by net.TestTimeoutUDP /go/src/net/timeout_test.go:247 +0xc9 (snip) Leaked sockets: 3: {Cookie:615726511685632 Err:<nil> SocketErr:0} 5: {Cookie:7934075906097152 Err:<nil> SocketErr:0} Socket statistical information: {Family:1 Type:805306370 Protocol:0 Opened:17 Accepted:0 Connected:5 Closed:17} {Family:2 Type:805306369 Protocol:0 Opened:450 Accepted:234 Connected:279 Closed:636} {Family:1 Type:805306369 Protocol:0 Opened:11 Accepted:5 Connected:5 Closed:16} {Family:28 Type:805306369 Protocol:0 Opened:95 Accepted:22 Connected:16 Closed:116} {Family:2 Type:805306370 Protocol:0 Opened:84 Accepted:0 Connected:34 Closed:83} {Family:28 Type:805306370 Protocol:0 Opened:52 Accepted:0 Connected:4 Closed:52} Change-Id: I0e84be59a0699bc31245c78e2249423459b8cdda Reviewed-on: https://go-review.googlesource.com/6390 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: fix some typos in commentsIan Lance Taylor2015-01-151-2/+2
| | | | | | | Change-Id: I1bf1ab930a5c258f5fcc85ca3037692c71bf3cb2 Reviewed-on: https://go-review.googlesource.com/2870 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Reviewed-by: Minux Ma <minux@golang.org>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+246
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.