The zone DB no longer considers duplciates of (IP, name); it will reject duplicates of (IP, name, ident), but this ultimately doesn't matter since those are all the fields it records anyway. The HTTP interface treats these duplicates as trivial success (i.e., it acts as if it's idempotent, which it is). This changes the behaviour for removals: if (IP, name) is recorded for two different containers, removing one will leave the other extant.
39 lines
997 B
Go
39 lines
997 B
Go
package nameserver
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func assertNoErr(t *testing.T, err error) {
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func assertStatus(t *testing.T, got int, wanted int, desc string) {
|
|
if got != wanted {
|
|
t.Fatalf("Expected %s %d but got %d", desc, wanted, got)
|
|
}
|
|
}
|
|
|
|
func assertErrorInterface(t *testing.T, got interface{}, wanted interface{}, desc string) {
|
|
if got == nil {
|
|
t.Fatalf("Expected %s but got nil (%s)", reflect.TypeOf(wanted).Elem(), desc)
|
|
}
|
|
gotT, wantedT := reflect.TypeOf(got), reflect.TypeOf(wanted).Elem()
|
|
if !gotT.Implements(wantedT) {
|
|
t.Fatalf("Expected %s but got %s (%s)", wantedT, gotT, desc)
|
|
}
|
|
}
|
|
|
|
func assertErrorType(t *testing.T, got interface{}, wanted interface{}, desc string) {
|
|
if got == nil {
|
|
t.Fatalf("Expected %s but got nil (%s)", reflect.TypeOf(wanted).Elem(), desc)
|
|
}
|
|
gotT, wantedT := reflect.TypeOf(got), reflect.TypeOf(wanted).Elem()
|
|
if gotT != wantedT {
|
|
t.Fatalf("Expected %s but got %s (%s)", wantedT, gotT, desc)
|
|
}
|
|
}
|