diff options
author | 2016-08-19 17:14:17 -0700 | |
---|---|---|
committer | 2016-08-19 17:14:17 -0700 | |
commit | 9ac3cab1b7b1b1e78f86ce3c6a80fbee312162e6 (patch) | |
tree | 437e9755927c33af16276ad2602a6da115f948cb /test/kubernetes_test.go | |
parent | a1989c35231b0e5ea271b2f68d82c1a63e697cd0 (diff) | |
download | coredns-9ac3cab1b7b1b1e78f86ce3c6a80fbee312162e6.tar.gz coredns-9ac3cab1b7b1b1e78f86ce3c6a80fbee312162e6.tar.zst coredns-9ac3cab1b7b1b1e78f86ce3c6a80fbee312162e6.zip |
Make CoreDNS a server type plugin for Caddy (#220)
* Make CoreDNS a server type plugin for Caddy
Remove code we don't need and port all middleware over. Fix all tests
and rework the documentation.
Also make `go generate` build a caddy binary which we then copy into
our directory. This means `go build`-builds remain working as-is.
And new etc instances in each etcd test for better isolation.
Fix more tests and rework test.Server with the newer support Caddy offers.
Fix Makefile to support new mode of operation.
Diffstat (limited to 'test/kubernetes_test.go')
-rw-r--r-- | test/kubernetes_test.go | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/test/kubernetes_test.go b/test/kubernetes_test.go index 55939e350..009b50657 100644 --- a/test/kubernetes_test.go +++ b/test/kubernetes_test.go @@ -3,12 +3,12 @@ package test import ( - "fmt" "io/ioutil" "log" "testing" "github.com/miekg/coredns/middleware/kubernetes/k8stest" + "github.com/miekg/dns" ) @@ -64,9 +64,8 @@ var testdataLookupSRV = []struct { } func TestK8sIntegration(t *testing.T) { - t.Log(" === RUN testLookupA") + // subtests here (Go 1.7 feature). testLookupA(t) - t.Log(" === RUN testLookupSRV") testLookupSRV(t) } @@ -75,7 +74,7 @@ func testLookupA(t *testing.T) { t.Skip("Skipping Kubernetes Integration tests. Kubernetes is not running") } - coreFile := + corefile := `.:0 { kubernetes coredns.local { endpoint http://localhost:8080 @@ -83,16 +82,20 @@ func testLookupA(t *testing.T) { } ` - server, _, udp, err := Server(t, coreFile) + server, err := CoreDNSServer(corefile) if err != nil { - t.Fatal("Could not get server: %s", err) + t.Fatalf("could not get CoreDNS serving instance: %s", err) + } + + udp, _ := CoreDNSServerPorts(server, 0) + if udp == "" { + t.Fatalf("could not get udp listening port") } defer server.Stop() log.SetOutput(ioutil.Discard) for _, testData := range testdataLookupA { - t.Logf("[log] Testing query string: '%v'\n", testData.Query) dnsClient := new(dns.Client) dnsMessage := new(dns.Msg) @@ -125,7 +128,7 @@ func testLookupSRV(t *testing.T) { t.Skip("Skipping Kubernetes Integration tests. Kubernetes is not running") } - coreFile := + corefile := `.:0 { kubernetes coredns.local { endpoint http://localhost:8080 @@ -133,9 +136,13 @@ func testLookupSRV(t *testing.T) { } ` - server, _, udp, err := Server(t, coreFile) + server, err := CoreDNSServer(corefile) if err != nil { - t.Fatal("Could not get server: %s", err) + t.Fatalf("could not get CoreDNS serving instance: %s", err) + } + udp, _ := CoreDNSServerPorts(server, 0) + if udp == "" { + t.Fatalf("could not get udp listening port") } defer server.Stop() @@ -144,7 +151,6 @@ func testLookupSRV(t *testing.T) { // TODO: Add checks for A records in additional section for _, testData := range testdataLookupSRV { - t.Logf("[log] Testing query string: '%v'\n", testData.Query) dnsClient := new(dns.Client) dnsMessage := new(dns.Msg) @@ -158,7 +164,6 @@ func testLookupSRV(t *testing.T) { // Count SRV records in the answer section srvRecordCount := 0 for _, a := range res.Answer { - fmt.Printf("RR: %v\n", a) if a.Header().Rrtype == dns.TypeSRV { srvRecordCount++ } |