aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/clouddns/clouddns.go8
-rw-r--r--plugin/clouddns/clouddns_test.go18
2 files changed, 23 insertions, 3 deletions
diff --git a/plugin/clouddns/clouddns.go b/plugin/clouddns/clouddns.go
index e09c247be..0e31a40cd 100644
--- a/plugin/clouddns/clouddns.go
+++ b/plugin/clouddns/clouddns.go
@@ -161,16 +161,18 @@ func updateZoneFromRRS(rrs *gcp.ResourceRecordSetsListResponse, z *file.Zone) er
if rr.Type == "CNAME" || rr.Type == "PTR" {
value = dns.Fqdn(value)
}
-
// Assemble RFC 1035 conforming record to pass into dns scanner.
rfc1035 = fmt.Sprintf("%s %d IN %s %s", dns.Fqdn(rr.Name), rr.Ttl, rr.Type, value)
r, err = dns.NewRR(rfc1035)
if err != nil {
return fmt.Errorf("failed to parse resource record: %v", err)
}
- }
- z.Insert(r)
+ err = z.Insert(r)
+ if err != nil {
+ return fmt.Errorf("failed to insert record: %v", err)
+ }
+ }
}
return nil
}
diff --git a/plugin/clouddns/clouddns_test.go b/plugin/clouddns/clouddns_test.go
index e052bf256..62c4cedb3 100644
--- a/plugin/clouddns/clouddns_test.go
+++ b/plugin/clouddns/clouddns_test.go
@@ -114,6 +114,15 @@ func (c fakeGCPClient) listRRSets(ctx context.Context, projectName, hostedZoneNa
Type: "SOA",
Rrdatas: []string{"ns-cloud-e1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 300 259200 300"},
},
+ {
+ Name: "_dummy._tcp.example.org.",
+ Ttl: 300,
+ Type: "SRV",
+ Rrdatas: []string{
+ "0 0 5269 split-example.org",
+ "0 0 5269 other-example.org",
+ },
+ },
}
}
@@ -262,6 +271,15 @@ func TestCloudDNS(t *testing.T) {
"www.example.org. 300 IN A 1.2.3.4",
},
},
+ // 13. example.org SRV found with 2 answers - success.
+ {
+ qname: "_dummy._tcp.example.org.",
+ qtype: dns.TypeSRV,
+ wantAnswer: []string{
+ "_dummy._tcp.example.org. 300 IN SRV 0 0 5269 split-example.org.",
+ "_dummy._tcp.example.org. 300 IN SRV 0 0 5269 other-example.org.",
+ },
+ },
}
for ti, tc := range tests {