Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acde238d00 |
@@ -444,6 +444,47 @@ func TestQueryServers_EveryRootServerRefused(t *testing.T) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestQueryServers_NotEveryRootServerRefused passes google.com's
|
||||||
|
// nameservers and 192.0.2.1 to QueryServers as the servers of the root
|
||||||
|
// zone. The google.com nameservers refuse a query about cloudflare.com,
|
||||||
|
// but nothing answers at 192.0.2.1, a documentation address, so not
|
||||||
|
// every server refused, wherever 192.0.2.1 falls in the random order:
|
||||||
|
// the error is not ErrIntercepted and does not say every server refused.
|
||||||
|
func TestQueryServers_NotEveryRootServerRefused(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
r := newTestResolver(t)
|
||||||
|
servers := googleNameserverIPv4s(t, r)
|
||||||
|
servers = append(servers, "192.0.2.1")
|
||||||
|
|
||||||
|
var err error
|
||||||
|
|
||||||
|
livednstest.Retry(
|
||||||
|
t,
|
||||||
|
"QueryServers(google.com servers and 192.0.2.1, cloudflare.com)",
|
||||||
|
func(ctx context.Context) error {
|
||||||
|
_, err = r.QueryServers(
|
||||||
|
ctx, servers, ".", "cloudflare.com.", dns.TypeNS,
|
||||||
|
)
|
||||||
|
|
||||||
|
// An attempt that ran out of time may not have asked every
|
||||||
|
// server, so it is tried again.
|
||||||
|
if ctx.Err() != nil {
|
||||||
|
return fmt.Errorf(
|
||||||
|
"%w: %w", livednstest.ErrNoAnswer, err,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
require.Error(t, err)
|
||||||
|
require.NotErrorIs(t, err, resolver.ErrIntercepted)
|
||||||
|
// Both errors for every server refusing say "refused a query for".
|
||||||
|
require.NotContains(t, err.Error(), "refused a query for")
|
||||||
|
}
|
||||||
|
|
||||||
func TestQueryNameserver_RecordsSorted(t *testing.T) {
|
func TestQueryNameserver_RecordsSorted(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user