|
|
|
@ -274,14 +274,27 @@ func TestResolveReverse(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ipv6Works() bool {
|
|
|
|
|
c, err := net.Listen("tcp", "[::1]:0")
|
|
|
|
|
if err != nil {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
c.Close()
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDelegate(t *testing.T) {
|
|
|
|
|
tstest.ResourceCheck(t)
|
|
|
|
|
|
|
|
|
|
if !ipv6Works() {
|
|
|
|
|
t.Skip("skipping test that requires localhost IPv6")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dnsHandleFunc("test.site.", resolveToIP(testipv4, testipv6, "dns.test.site."))
|
|
|
|
|
dnsHandleFunc("nxdomain.site.", resolveToNXDOMAIN)
|
|
|
|
|
|
|
|
|
|
v4server, v4errch := serveDNS("127.0.0.1:0")
|
|
|
|
|
v6server, v6errch := serveDNS("[::1]:0")
|
|
|
|
|
v4server, v4errch := serveDNS(t, "127.0.0.1:0")
|
|
|
|
|
v6server, v6errch := serveDNS(t, "[::1]:0")
|
|
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
|
if err := <-v4errch; err != nil {
|
|
|
|
@ -371,7 +384,7 @@ func TestDelegate(t *testing.T) {
|
|
|
|
|
func TestDelegateCollision(t *testing.T) {
|
|
|
|
|
dnsHandleFunc("test.site.", resolveToIP(testipv4, testipv6, "dns.test.site."))
|
|
|
|
|
|
|
|
|
|
server, errch := serveDNS("127.0.0.1:0")
|
|
|
|
|
server, errch := serveDNS(t, "127.0.0.1:0")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err := <-errch; err != nil {
|
|
|
|
|
t.Errorf("server error: %v", err)
|
|
|
|
@ -473,7 +486,7 @@ func TestConcurrentSetMap(t *testing.T) {
|
|
|
|
|
func TestConcurrentSetUpstreams(t *testing.T) {
|
|
|
|
|
dnsHandleFunc("test.site.", resolveToIP(testipv4, testipv6, "dns.test.site."))
|
|
|
|
|
|
|
|
|
|
server, errch := serveDNS("127.0.0.1:0")
|
|
|
|
|
server, errch := serveDNS(t, "127.0.0.1:0")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err := <-errch; err != nil {
|
|
|
|
|
t.Errorf("server error: %v", err)
|
|
|
|
@ -752,7 +765,7 @@ func TestTrimRDNSBonjourPrefix(t *testing.T) {
|
|
|
|
|
func BenchmarkFull(b *testing.B) {
|
|
|
|
|
dnsHandleFunc("test.site.", resolveToIP(testipv4, testipv6, "dns.test.site."))
|
|
|
|
|
|
|
|
|
|
server, errch := serveDNS("127.0.0.1:0")
|
|
|
|
|
server, errch := serveDNS(b, "127.0.0.1:0")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err := <-errch; err != nil {
|
|
|
|
|
b.Errorf("server error: %v", err)
|
|
|
|
|