fix: repair malformed SOA and expand release verification
This commit is contained in:
1 parent
5d7da681e7
commit
3623006f25
11 files changed
+106
-4
No files matched your search
@@ -227,3 +227,23 @@ func TestValidateZoneChangePairs(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepairMalformedSOAWithConflictingCNAME(t *testing.T) {
|
||||
base := modelBaseZone()
|
||||
broken := base[0]
|
||||
broken.Content.String = strings.Replace(broken.Content.String, `"refresh":3600`, `"refresh":"invalid"`, 1)
|
||||
if validSOAContent(broken) {
|
||||
t.Fatal("test SOA must have invalid content")
|
||||
}
|
||||
cname := modelRawRow(3, "", "CNAME", 3600, `{"host":"target.example."}`)
|
||||
current := []recordRow{broken, base[1], cname}
|
||||
repair := zoneChanges{SOAUpdate: &base[0]}
|
||||
if problems, _ := validateZoneChanges(base[0].Zone, current, repair); len(problems) != 0 {
|
||||
t.Fatalf("SOA repair rejected: %+v", problems)
|
||||
}
|
||||
current = repair.finalRows(current)
|
||||
remove := zoneChanges{Deletes: []int64{cname.ID}}
|
||||
if problems, _ := validateZoneChanges(base[0].Zone, current, remove); len(problems) != 0 {
|
||||
t.Fatalf("CNAME removal rejected after SOA repair: %+v", problems)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user