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:
1 parent
53444bec7a
commit
a7ba01fc77
21 files changed
+1315
-170
No files matched your search
+18
-2
@@ -4,6 +4,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -100,8 +101,23 @@ func TestUpdateSOASerial(t *testing.T) {
|
||||
t.Fatalf("unexpected SOA: %+v, %v", row, err)
|
||||
}
|
||||
}
|
||||
if _, err := updateSOASerial(append(current, current[0]), changes, modelNow); err == nil {
|
||||
t.Fatal("bumped ambiguous SOA")
|
||||
duplicate := current[0]
|
||||
duplicate.ID = 99
|
||||
ambiguous := append(slices.Clone(current), duplicate)
|
||||
if row, err := updateSOASerial(ambiguous, zoneChanges{Creates: changes.Creates}, modelNow); err != nil || row != nil {
|
||||
t.Fatalf("bumped ambiguous SOA: %+v, %v", row, err)
|
||||
}
|
||||
if got := mustBump(ambiguous, zoneChanges{Deletes: []int64{1}}, 2026111801); got.ID != 99 {
|
||||
t.Fatalf("bumped the deleted SOA: %+v", got)
|
||||
}
|
||||
moved := current[0]
|
||||
moved.Name = "below"
|
||||
if got := mustBump([]recordRow{moved, current[1]}, zoneChanges{Updates: []recordRow{current[0]}}, 2026111801); got.Name != "" {
|
||||
t.Fatalf("lost the moved SOA: %+v", got)
|
||||
}
|
||||
converted := modelRawRow(7, "", "A", 1, `{"ip":"192.0.2.1"}`)
|
||||
if row, err := updateSOASerial([]recordRow{converted}, zoneChanges{Updates: []recordRow{modelRawRow(7, "", "SOA", 1, modelSOAContent)}}, modelNow); err != nil || row != nil {
|
||||
t.Fatalf("bumped a row that was not an SOA: %+v, %v", row, err)
|
||||
}
|
||||
if _, err := withSOASerial(recordRow{}, 42, true); err == nil {
|
||||
t.Fatal("bumped absent SOA")
|
||||
|
||||
Reference in new issue
Block a user