coredns/middleware/kubernetes/subzone_test.go
Miek Gieben 5301c5af5f Run golint and go vet (#276)
Cleanup the errors and removed deadcode along the way. The leaves
some error laying around, mostly about commenting exported identifier.
We should look hard if those really are needed.
2016-09-21 17:01:19 +01:00

32 lines
832 B
Go

package kubernetes
import (
"testing"
)
// List of configured zones to test against
var confZones = []string{
"a.b.c",
"d",
}
// Map of zonename :: expected boolean result
var examplesSubzoneConflict = map[string]bool{
"a.b.c": true, // conflicts with zone "a.b.c"
"b.c": true, // conflicts with zone "a.b.c"
"c": true, // conflicts with zone "a.b.c"
"e": false, // no conflict
"a.b.c.e": false, // no conflict
"a.b.c.d": true, // conflicts with zone "d"
"": false,
}
func TestSubzoneConflict(t *testing.T) {
for z, expected := range examplesSubzoneConflict {
actual, conflicts := subzoneConflict(confZones, z)
if actual != expected {
t.Errorf("Expected conflict result '%v' for example '%v'. Instead got '%v'. Conflicting zones are: %v", expected, z, actual, conflicts)
}
}
}