mirror of https://github.com/golang/go.git
net: don't skip TestGoLookupIPCNAMEOrderHostsAliasesDNSFilesMode
Change-Id: Ie71b802745d6f1b4ae137e36cf754d3f7154671d
This commit is contained in:
parent
9138743679
commit
f5777d8c20
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"internal/testenv"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -2200,9 +2199,6 @@ var goLookupIPCNAMEOrderDNSFilesModeTests = []struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGoLookupIPCNAMEOrderHostsAliasesDNSFilesMode(t *testing.T) {
|
func TestGoLookupIPCNAMEOrderHostsAliasesDNSFilesMode(t *testing.T) {
|
||||||
if testenv.Builder() == "" {
|
|
||||||
t.Skip("Makes assumptions about local networks and (re)naming that aren't always true")
|
|
||||||
}
|
|
||||||
defer func(orig string) { testHookHostsPath = orig }(testHookHostsPath)
|
defer func(orig string) { testHookHostsPath = orig }(testHookHostsPath)
|
||||||
testHookHostsPath = "testdata/aliases"
|
testHookHostsPath = "testdata/aliases"
|
||||||
mode := hostLookupDNSFiles
|
mode := hostLookupDNSFiles
|
||||||
|
|
@ -2213,9 +2209,29 @@ func TestGoLookupIPCNAMEOrderHostsAliasesDNSFilesMode(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testGoLookupIPCNAMEOrderHostsAliases(t *testing.T, mode hostLookupOrder, lookup, lookupRes string) {
|
func testGoLookupIPCNAMEOrderHostsAliases(t *testing.T, mode hostLookupOrder, lookup, lookupRes string) {
|
||||||
|
fake := fakeDNSServer{
|
||||||
|
rh: func(_, _ string, q dnsmessage.Message, _ time.Time) (dnsmessage.Message, error) {
|
||||||
|
var answers []dnsmessage.Resource
|
||||||
|
|
||||||
|
if mode != hostLookupDNSFiles {
|
||||||
|
t.Fatal("received unexpected DNS query")
|
||||||
|
}
|
||||||
|
|
||||||
|
return dnsmessage.Message{
|
||||||
|
Header: dnsmessage.Header{
|
||||||
|
ID: q.Header.ID,
|
||||||
|
Response: true,
|
||||||
|
},
|
||||||
|
Questions: []dnsmessage.Question{q.Questions[0]},
|
||||||
|
Answers: answers,
|
||||||
|
}, nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
r := Resolver{PreferGo: true, Dial: fake.DialContext}
|
||||||
ins := []string{lookup, absDomainName(lookup), strings.ToLower(lookup), strings.ToUpper(lookup)}
|
ins := []string{lookup, absDomainName(lookup), strings.ToLower(lookup), strings.ToUpper(lookup)}
|
||||||
for _, in := range ins {
|
for _, in := range ins {
|
||||||
_, res, err := goResolver.goLookupIPCNAMEOrder(context.Background(), "ip", in, mode, nil)
|
_, res, err := r.goLookupIPCNAMEOrder(context.Background(), "ip", in, mode, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("expected err == nil, but got error: %v", err)
|
t.Errorf("expected err == nil, but got error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue