Update ddns_test.go

This commit is contained in:
77-QiQi authored and GitHub committed 2026-09-14 10:36:04 +08:00
1 parent 09db8b4361
commit e9ddd46655
1 file changed
+10 -3
+10 -3
View File
@@ -25,9 +25,16 @@ func TestSplitDomainSOA(t *testing.T) {
m.SetReply(r) m.SetReply(r)
if len(r.Question) > 0 { if len(r.Question) > 0 {
qname := r.Question[0].Name qname := r.Question[0].Name
if strings.HasSuffix(qname, "example.co.uk.") || strings.HasSuffix(qname, "example.com.") { var zoneName string
if strings.HasSuffix(qname, "example.co.uk.") {
zoneName = "example.co.uk."
} else if strings.HasSuffix(qname, "example.com.") {
zoneName = "example.com."
}
if zoneName != "" {
soa := &dns.SOA{ soa := &dns.SOA{
Hdr: dns.RR_Header{Name: qname, Rrtype: dns.TypeSOA, Class: dns.ClassINET, Ttl: 300}, Hdr: dns.RR_Header{Name: zoneName, Rrtype: dns.TypeSOA, Class: dns.ClassINET, Ttl: 300},
Ns: "ns.example.com.", Ns: "ns.example.com.",
Mbox: "admin.example.com.", Mbox: "admin.example.com.",
Serial: 1, Serial: 1,
@@ -219,7 +226,7 @@ func TestTransientSOAFailureAndRetry(t *testing.T) {
provider := &Provider{ provider := &Provider{
DDNSProfile: &model.DDNSProfile{ DDNSProfile: &model.DDNSProfile{
MaxRetries: maxRetries, MaxRetries: maxRetries,
Domains: []string{"fail"}, Domains: []string{"example.com"},
}, },
IPAddrs: &model.IP{IPv4Addr: "1.1.1.1"}, IPAddrs: &model.IP{IPv4Addr: "1.1.1.1"},
Setter: &MockSetter{}, Setter: &MockSetter{},