Skip to content

Commit 9ae47e2

Browse files
TMHSDigitalclaude
andcommitted
Test: refuse "bad-" names so a wildcard probe never matches
TestNoAbortScanSucceedsDespiteFailingLookups (and TestAutoRateNotice) refused every name starting with "bad". The wildcard probe asks a random 32-character hex label, which starts with "bad" about once in 4096 runs; that probe was refused, the wildcard check was inconclusive, and the test failed (seen once on the macOS CI leg). The refused words now start with "bad-", which a hex label cannot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 637a950 commit 9ae47e2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎pkg/subenum/subenum_test.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,15 +477,15 @@ func TestMaxDuration(t *testing.T) {
477477
// while Run still reports the warning.
478478
func TestNoAbortScanSucceedsDespiteFailingLookups(t *testing.T) {
479479
srv := dnstest.Start(t, func(q dnstest.Query) dnstest.Reply {
480-
if strings.HasPrefix(q.Name, "bad") {
480+
if strings.HasPrefix(q.Name, "bad-") {
481481
return dnstest.Refused
482482
}
483483
return dnstest.NXDomain
484484
})
485485
words := make([]string, 0, 300)
486486
for i := range 300 {
487487
if i%2 == 0 {
488-
words = append(words, fmt.Sprintf("bad%d", i))
488+
words = append(words, fmt.Sprintf("bad-%d", i))
489489
} else {
490490
words = append(words, fmt.Sprintf("ok%d", i))
491491
}
@@ -759,15 +759,15 @@ func TestRecursiveWildcardBranchNotice(t *testing.T) {
759759
// slows the scan down with a NoticeRate instead of stopping it.
760760
func TestAutoRateNotice(t *testing.T) {
761761
srv := dnstest.Start(t, func(q dnstest.Query) dnstest.Reply {
762-
if strings.HasPrefix(q.Name, "bad") {
762+
if strings.HasPrefix(q.Name, "bad-") {
763763
return dnstest.Refused
764764
}
765765
return dnstest.NXDomain
766766
})
767767
// Failures first, so the first window AutoRate judges is a bad one.
768768
words := make([]string, 0, 400)
769769
for i := range 300 {
770-
words = append(words, fmt.Sprintf("bad%d", i))
770+
words = append(words, fmt.Sprintf("bad-%d", i))
771771
}
772772
for i := range 100 {
773773
words = append(words, fmt.Sprintf("ok%d", i))

0 commit comments

Comments
 (0)