c: &conf{
goos: "openbsd",
},
- resolv: &dnsConfig{lookup: []string{"bind", "file"}},
+ resolv: &dnsConfig{servers: defaultNS, lookup: []string{"bind", "file"}},
hostTests: []nssHostTest{
{"google.com", "myhostname", hostLookupDNSFiles},
{"foo.local", "myhostname", hostLookupDNSFiles},
c: &conf{
goos: "openbsd",
},
- resolv: &dnsConfig{lookup: []string{"file", "bind"}},
+ resolv: &dnsConfig{servers: defaultNS, lookup: []string{"file", "bind"}},
hostTests: []nssHostTest{{"google.com", "myhostname", hostLookupFilesDNS}},
},
{
c: &conf{
goos: "openbsd",
},
- resolv: &dnsConfig{lookup: []string{"bind"}},
+ resolv: &dnsConfig{servers: defaultNS, lookup: []string{"bind"}},
hostTests: []nssHostTest{{"google.com", "myhostname", hostLookupDNS}},
},
{
c: &conf{
goos: "openbsd",
},
- resolv: &dnsConfig{lookup: []string{"file"}},
+ resolv: &dnsConfig{servers: defaultNS, lookup: []string{"file"}},
hostTests: []nssHostTest{{"google.com", "myhostname", hostLookupFiles}},
},
{
c: &conf{
goos: "openbsd",
},
- resolv: &dnsConfig{lookup: []string{"file", "bind", "yp"}},
+ resolv: &dnsConfig{servers: defaultNS, lookup: []string{"file", "bind", "yp"}},
hostTests: []nssHostTest{{"google.com", "myhostname", hostLookupCgo}},
},
{
c: &conf{
goos: "openbsd",
},
- resolv: &dnsConfig{lookup: []string{"file", "foo"}},
+ resolv: &dnsConfig{servers: defaultNS, lookup: []string{"file", "foo"}},
hostTests: []nssHostTest{{"google.com", "myhostname", hostLookupCgo}},
},
{
c: &conf{
goos: "openbsd",
},
- resolv: &dnsConfig{lookup: nil},
+ resolv: &dnsConfig{servers: defaultNS, lookup: nil},
hostTests: []nssHostTest{{"google.com", "myhostname", hostLookupDNSFiles}},
},
{
conf.initOnce.Do(conf.init)
dc := conf.dnsConfig.Load()
+
+ // Currently we should never have a config that does not have any
+ // available servers to query, since in such cases the servers field
+ // is set to [defaultNS], see dnsReadConfig.
+ // This assertion main purpose is for testing, such that we never set
+ // the mocked dnsConfig in such way.
+ if len(dc.servers) == 0 {
+ panic("unreachable")
+ }
+
if dc.noReload {
return
}