diff options
Diffstat (limited to 'test/kubernetes_test.go')
-rw-r--r-- | test/kubernetes_test.go | 157 |
1 files changed, 6 insertions, 151 deletions
diff --git a/test/kubernetes_test.go b/test/kubernetes_test.go index d99ca1618..f9a0b00c4 100644 --- a/test/kubernetes_test.go +++ b/test/kubernetes_test.go @@ -3,6 +3,8 @@ package test import ( + "io/ioutil" + "log" "os" "testing" "time" @@ -13,6 +15,10 @@ import ( "github.com/miekg/dns" ) +func init() { + log.SetOutput(ioutil.Discard) +} + // Test data // TODO: Fix the actual RR values @@ -219,25 +225,6 @@ var dnsTestCases = []test.Case{ Answer: []dns.RR{}, }, { - Qname: "123.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{}, - }, - { - Qname: "100.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.PTR("100.0.0.10.in-addr.arpa. 303 IN PTR svc-1-a.test-1.svc.cluster.local."), - }, - }, - { - Qname: "115.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.PTR("115.0.0.10.in-addr.arpa. 303 IN PTR svc-c.test-1.svc.cluster.local."), - }, - }, - { Qname: "dns-version.cluster.local.", Qtype: dns.TypeTXT, Rcode: dns.RcodeSuccess, Answer: []dns.RR{ @@ -245,13 +232,6 @@ var dnsTestCases = []test.Case{ }, }, { - Qname: "next-in-chain.", Qtype: dns.TypeA, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.A("next-in-chain. 0 IN A 192.0.2.53"), - }, - }, - { Qname: "cluster.local.", Qtype: dns.TypeNS, Rcode: dns.RcodeSuccess, Answer: []dns.RR{ @@ -303,80 +283,6 @@ var dnsTestCasesPodsVerified = []test.Case{ }, } -var dnsTestCasesCidrReverseZone = []test.Case{ - { - Qname: "123.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{}, - }, - { - Qname: "100.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.PTR("100.0.0.10.in-addr.arpa. 303 IN PTR svc-1-a.test-1.svc.cluster.local."), - }, - }, - { - Qname: "110.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.PTR("115.0.0.10.in-addr.arpa. 303 IN PTR svc-1-b.test-1.svc.cluster.local."), - }, - }, - { - Qname: "115.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.PTR("115.0.0.10.in-addr.arpa. 303 IN PTR svc-c.test-1.svc.cluster.local."), - }, - }, - { - Qname: "next-in-chain.", Qtype: dns.TypeA, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.A("next-in-chain. 0 IN A 192.0.2.53"), - }, - }, -} - -var dnsTestCasesPartialCidrReverseZone = []test.Case{ - { - // In exposed range, record not present = OK + No data - Qname: "99.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{}, - }, - { - // In exposed range, record present = OK + Data - Qname: "100.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.PTR("100.0.0.10.in-addr.arpa. 303 IN PTR svc-1-a.test-1.svc.cluster.local."), - }, - }, - { - // In exposed range, record present = OK + Data - Qname: "110.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.PTR("115.0.0.10.in-addr.arpa. 303 IN PTR svc-1-b.test-1.svc.cluster.local."), - }, - }, - { - // Out of exposed range, record present = pass to next middleware (not existing in test) = FAIL - Qname: "115.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeServerFailure, - Answer: []dns.RR{}, - }, - { - Qname: "next-in-chain.", Qtype: dns.TypeA, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.A("next-in-chain. 0 IN A 192.0.2.53"), - }, - }, -} - var dnsTestCasesAllNSExposed = []test.Case{ { Qname: "svc-1-a.test-1.svc.cluster.local.", Qtype: dns.TypeA, @@ -392,25 +298,6 @@ var dnsTestCasesAllNSExposed = []test.Case{ test.A("svc-c.test-1.svc.cluster.local. 303 IN A 10.0.0.120"), }, }, - { - Qname: "123.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{}, - }, - { - Qname: "100.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.PTR("100.0.0.10.in-addr.arpa. 303 IN PTR svc-1-a.test-1.svc.cluster.local."), - }, - }, - { - Qname: "120.0.0.10.in-addr.arpa.", Qtype: dns.TypePTR, - Rcode: dns.RcodeSuccess, - Answer: []dns.RR{ - test.PTR("120.0.0.10.in-addr.arpa. 303 IN PTR svc-c.test-2.svc.cluster.local."), - }, - }, } var dnsTestCasesFallthrough = []test.Case{ @@ -558,42 +445,11 @@ func TestKubernetesIntegrationPodsVerified(t *testing.T) { doIntegrationTests(t, corefile, dnsTestCasesPodsVerified) } -func TestKubernetesIntegrationCidrReverseZone(t *testing.T) { - corefile := - `.:0 { - kubernetes cluster.local { - endpoint http://localhost:8080 - namespaces test-1 - cidrs 10.0.0.0/24 - } - erratic . { - drop 0 - } -` - doIntegrationTests(t, corefile, dnsTestCasesCidrReverseZone) -} - -func TestKubernetesIntegrationPartialCidrReverseZone(t *testing.T) { - corefile := - `.:0 { - kubernetes cluster.local { - endpoint http://localhost:8080 - namespaces test-1 - cidrs 10.0.0.96/28 10.0.0.120/32 - } - erratic . { - drop 0 - } -` - doIntegrationTests(t, corefile, dnsTestCasesPartialCidrReverseZone) -} - func TestKubernetesIntegrationAllNSExposed(t *testing.T) { corefile := `.:0 { kubernetes cluster.local { endpoint http://localhost:8080 - cidrs 10.0.0.0/24 } ` doIntegrationTests(t, corefile, dnsTestCasesAllNSExposed) @@ -615,7 +471,6 @@ func TestKubernetesIntegrationFallthrough(t *testing.T) { file ` + dbfile + ` cluster.local kubernetes cluster.local { endpoint http://localhost:8080 - cidrs 10.0.0.0/24 namespaces test-1 upstream ` + udp + ` fallthrough |