refactor(api): use audit operation constants and the shared zone not found error in zone handlers

- refactor(api): use audit operation constants and the shared zone not found error in zone handlers
- fix(api): return the stored content of rows with check errors
- fix(api): return warnings from record deletes, zone creation and import apply
- fix(api): allow repairing rows stored with a non canonical zone and invalid SOA sets
- fix(check): accept JSON column formatting and an absent SOA serial as canonical content
- fix(ui): match audit diff items by identity instead of array index
- fix(ui): count the SOA change once, report import warnings and check the request size
- fix(ui): edit the selected SOA row, keep the server order, show error rows raw and report write warnings
- test(check): cover triggering and clean pairs with exact codes and record ids
- test(records): cover SRV port, SOA timer and CAA value boundaries
- test(cli): check the exact check output and the exit code of warning-only zones
- refactor(import): order current rows with cmp.Compare
- test(check): cover malformed stored content and a mailbox stored as an address
- test(api): cover zone write failure paths, ambiguous SOA updates and unchanged record detection
This commit is contained in:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent 53444bec7a
commit a7ba01fc77
21 files changed
+1315 -170

No files matched your search

+3 -3
View File
@@ -75,7 +75,7 @@ func TestRecordStoreZones(t *testing.T) {
t.Fatalf("got %+v", zones)
}
c := onlyCall(t, st)
expectQuery(t, c, "FROM `coredns_records` r", "GROUP BY r.`zone`", "CAST(s.`record_type` AS BINARY) = 'SOA'")
expectQuery(t, c, "FROM `coredns_records` r", "GROUP BY `zone_key`", "ORDER BY k.`zone_key`", "CAST(s.`record_type` AS BINARY) = 'SOA'")
if _, err := s.ListZonesOfUser(ctx, 7); err != nil {
t.Fatal(err)
}
@@ -118,7 +118,7 @@ func TestRecordStoreReads(t *testing.T) {
if !reflect.DeepEqual(rows, want) {
t.Fatalf("got %+v", rows)
}
expectQuery(t, st.Calls()[1], "WHERE `zone` = ? ORDER BY `id`")
expectQuery(t, st.Calls()[1], zoneRowsWhere+" ORDER BY `id`")
if strings.Contains(st.Calls()[1].query, "FOR UPDATE") {
t.Fatal("plain read locks")
}
@@ -187,7 +187,7 @@ func TestRecordStoreWrites(t *testing.T) {
if n, err := s.DeleteZoneRecords(ctx, "a.org."); err != nil || n != 3 {
t.Fatal(n, err)
}
expectQuery(t, st.Calls()[3], "DELETE FROM `coredns_records` WHERE `zone` = ?")
expectQuery(t, st.Calls()[3], "DELETE FROM `coredns_records`"+zoneRowsWhere)
db, _ = newFakeDB(t, func(string, []any) fdbResponse { return fdbResponse{rowsAffected: 0} })
if ok, err := newRecordStore(db, fdbTables(t)).DeleteRecord(ctx, 5); ok || err != nil {
t.Fatal(ok, err)