From 6a4e69eb9fd0aa02c47d74d743ae4fce292dcbb7 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 22 Aug 2017 20:44:42 +0100 Subject: mw/kubernetes: Rewrite parseRequest and Readability improvements (#939) * mw/kubernetes: rewrite parseRequest Stop looking at the qtype in parseRequest and make k.Namespace a map. Fallout from this is that pkg/strings as it is not used anymore. Also add a few helper functions to make unexposed namespaces easier to see in the code. Add wildcard tests to the middleware tests. * Fix tests Add a whole bunch of comments to document what we are trying to do. * This is now answered * up coverage * duh * Update testcase * Make it nodata --- test/kubernetes_test.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'test/kubernetes_test.go') diff --git a/test/kubernetes_test.go b/test/kubernetes_test.go index 2ee5a2d7f..870f55e9d 100644 --- a/test/kubernetes_test.go +++ b/test/kubernetes_test.go @@ -203,13 +203,21 @@ var dnsTestCases = []test.Case{ }, { Qname: "*.svc-1-a.test-1.svc.cluster.local.", Qtype: dns.TypeSRV, - Rcode: dns.RcodeNameError, - Answer: []dns.RR{}, + Rcode: dns.RcodeSuccess, + Answer: []dns.RR{ + test.SRV("*.svc-1-a.test-1.svc.cluster.local. 0 IN SRV 0 50 443 172-17-0-7.svc-1-a.test-1.svc.cluster.local."), + test.SRV("*.svc-1-a.test-1.svc.cluster.local. 0 IN SRV 0 50 80 172-17-0-7.svc-1-a.test-1.svc.cluster.local."), + }, + Extra: []dns.RR{ + test.A("172-17-0-7.svc-1-a.test-1.svc.cluster.local. 0 IN A 172.17.0.7"), + }, }, { Qname: "*._not-udp-or-tcp.svc-1-a.test-1.svc.cluster.local.", Qtype: dns.TypeSRV, - Rcode: dns.RcodeNameError, - Answer: []dns.RR{}, + Rcode: dns.RcodeSuccess, + Ns: []dns.RR{ + test.SOA("cluster.local. 300 IN SOA ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 60"), + }, }, { Qname: "svc-1-a.test-1.svc.cluster.local.", Qtype: dns.TypeSRV, -- cgit v1.2.3