aboutsummaryrefslogtreecommitdiff
path: root/middleware/kubernetes/setup_test.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2017-01-15 03:12:28 -0500
committerGravatar Miek Gieben <miek@miek.nl> 2017-01-15 08:12:28 +0000
commita6d232a622a2f83a5d5ea1d9d946da7f910a0f9e (patch)
tree187a9366c8515bf1d8f6d483476555ea4f9897b8 /middleware/kubernetes/setup_test.go
parentb6a2a5aeaa0811199c6206eb87893eaa2298ae95 (diff)
downloadcoredns-a6d232a622a2f83a5d5ea1d9d946da7f910a0f9e.tar.gz
coredns-a6d232a622a2f83a5d5ea1d9d946da7f910a0f9e.tar.zst
coredns-a6d232a622a2f83a5d5ea1d9d946da7f910a0f9e.zip
dont require/allow "_" prefix for srv wildcard fields (#472)
* dont require/allow "_" prefix for srv wildcard fields * streamline parse/validation of req name * removing nametemplate * error when zone not found, loopify unit tests
Diffstat (limited to 'middleware/kubernetes/setup_test.go')
-rw-r--r--middleware/kubernetes/setup_test.go71
1 files changed, 0 insertions, 71 deletions
diff --git a/middleware/kubernetes/setup_test.go b/middleware/kubernetes/setup_test.go
index 72b60e5ce..eb327baf3 100644
--- a/middleware/kubernetes/setup_test.go
+++ b/middleware/kubernetes/setup_test.go
@@ -16,7 +16,6 @@ func TestKubernetesParse(t *testing.T) {
shouldErr bool // true if test case is exected to produce an error.
expectedErrContent string // substring from the expected error. Empty for positive cases.
expectedZoneCount int // expected count of defined zones.
- expectedNTValid bool // NameTemplate to be initialized and valid
expectedNSCount int // expected count of namespaces.
expectedResyncPeriod time.Duration // expected resync period value
expectedLabelSelector string // expected label selector value
@@ -28,7 +27,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
1,
- true,
0,
defaultResyncPeriod,
"",
@@ -39,7 +37,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
2,
- true,
0,
defaultResyncPeriod,
"",
@@ -51,7 +48,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
1,
- true,
0,
defaultResyncPeriod,
"",
@@ -64,20 +60,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
1,
- true,
- 0,
- defaultResyncPeriod,
- "",
- },
- {
- "template keyword with valid template",
- `kubernetes coredns.local {
- template {service}.{namespace}.{zone}
-}`,
- false,
- "",
- 1,
- true,
0,
defaultResyncPeriod,
"",
@@ -90,7 +72,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
1,
- true,
1,
defaultResyncPeriod,
"",
@@ -103,7 +84,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
1,
- true,
2,
defaultResyncPeriod,
"",
@@ -116,7 +96,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
1,
- true,
0,
30 * time.Second,
"",
@@ -129,7 +108,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
1,
- true,
0,
15 * time.Minute,
"",
@@ -142,7 +120,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
1,
- true,
0,
defaultResyncPeriod,
"environment=prod",
@@ -155,7 +132,6 @@ func TestKubernetesParse(t *testing.T) {
false,
"",
1,
- true,
0,
defaultResyncPeriod,
"application=nginx,environment in (production,qa,staging)",
@@ -165,14 +141,12 @@ func TestKubernetesParse(t *testing.T) {
`kubernetes coredns.local test.local {
resyncperiod 15m
endpoint http://localhost:8080
- template {service}.{namespace}.{zone}
namespaces demo test
labels environment in (production, staging, qa),application=nginx
}`,
false,
"",
2,
- true,
2,
15 * time.Minute,
"application=nginx,environment in (production,qa,staging)",
@@ -184,7 +158,6 @@ func TestKubernetesParse(t *testing.T) {
true,
"Kubernetes setup called without keyword 'kubernetes' in Corefile",
-1,
- false,
-1,
defaultResyncPeriod,
"",
@@ -195,7 +168,6 @@ func TestKubernetesParse(t *testing.T) {
true,
"Zone name must be provided for kubernetes middleware",
-1,
- true,
0,
defaultResyncPeriod,
"",
@@ -208,34 +180,7 @@ func TestKubernetesParse(t *testing.T) {
true,
"Wrong argument count or unexpected line ending after 'endpoint'",
-1,
- true,
- -1,
- defaultResyncPeriod,
- "",
- },
- {
- "template keyword without a template value",
- `kubernetes coredns.local {
- template
-}`,
- true,
- "Wrong argument count or unexpected line ending after 'template'",
- -1,
- false,
- 0,
- defaultResyncPeriod,
- "",
- },
- {
- "template keyword with an invalid template value",
- `kubernetes coredns.local {
- template {namespace}.{zone}
-}`,
- true,
- "Record name template does not pass NameTemplate validation",
-1,
- false,
- 0,
defaultResyncPeriod,
"",
},
@@ -247,7 +192,6 @@ func TestKubernetesParse(t *testing.T) {
true,
"Parse error: Wrong argument count or unexpected line ending after 'namespaces'",
-1,
- true,
-1,
defaultResyncPeriod,
"",
@@ -260,7 +204,6 @@ func TestKubernetesParse(t *testing.T) {
true,
"Wrong argument count or unexpected line ending after 'resyncperiod'",
-1,
- true,
0,
0 * time.Minute,
"",
@@ -273,7 +216,6 @@ func TestKubernetesParse(t *testing.T) {
true,
"Unable to parse resync duration value. Value provided was ",
-1,
- true,
0,
0 * time.Second,
"",
@@ -286,7 +228,6 @@ func TestKubernetesParse(t *testing.T) {
true,
"Unable to parse resync duration value. Value provided was ",
-1,
- true,
0,
0 * time.Second,
"",
@@ -299,7 +240,6 @@ func TestKubernetesParse(t *testing.T) {
true,
"Wrong argument count or unexpected line ending after 'labels'",
-1,
- true,
0,
0 * time.Second,
"",
@@ -312,7 +252,6 @@ func TestKubernetesParse(t *testing.T) {
true,
"Unable to parse label selector. Value provided was",
-1,
- true,
0,
0 * time.Second,
"",
@@ -354,16 +293,6 @@ func TestKubernetesParse(t *testing.T) {
t.Errorf("Test %d: Expected kubernetes controller to be initialized with %d zones, instead found %d zones: '%v' for input '%s'", i, test.expectedZoneCount, foundZoneCount, k8sController.Zones, test.input)
}
- // NameTemplate
- if k8sController.NameTemplate == nil {
- t.Errorf("Test %d: Expected kubernetes controller to be initialized with a NameTemplate. Instead found '%v' for input '%s'", i, k8sController.NameTemplate, test.input)
- } else {
- foundNTValid := k8sController.NameTemplate.IsValid()
- if foundNTValid != test.expectedNTValid {
- t.Errorf("Test %d: Expected NameTemplate validity to be '%v', instead found '%v' for input '%s'", i, test.expectedNTValid, foundNTValid, test.input)
- }
- }
-
// Namespaces
foundNSCount := len(k8sController.Namespaces)
if foundNSCount != test.expectedNSCount {