mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 18:53:43 -04:00
Cleanup and fixes (#223)
* Set version to 001 * Remove k8stest, test fails is k8s is not there: touch luck * Remove server directory: not used anymore * Disable k8s test (for now) * gometalinter changes
This commit is contained in:
@@ -77,10 +77,10 @@ func TestEtcdStubAndProxyLookup(t *testing.T) {
|
||||
t.Error("Expected to at least one RR in the answer section, got none")
|
||||
}
|
||||
if resp.Answer[0].Header().Rrtype != dns.TypeA {
|
||||
t.Error("Expected RR to A, got: %d", resp.Answer[0].Header().Rrtype)
|
||||
t.Errorf("Expected RR to A, got: %d", resp.Answer[0].Header().Rrtype)
|
||||
}
|
||||
if resp.Answer[0].(*dns.A).A.String() != "93.184.216.34" {
|
||||
t.Error("Expected 93.184.216.34, got: %d", resp.Answer[0].(*dns.A).A.String())
|
||||
t.Errorf("Expected 93.184.216.34, got: %d", resp.Answer[0].(*dns.A).A.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"log"
|
||||
"testing"
|
||||
|
||||
"github.com/miekg/coredns/middleware/kubernetes/k8stest"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
@@ -63,17 +61,13 @@ var testdataLookupSRV = []struct {
|
||||
{"*.*.coredns.local.", 1, 1}, // One SRV record, via namespace and service wildcard
|
||||
}
|
||||
|
||||
func TestK8sIntegration(t *testing.T) {
|
||||
func testK8sIntegration(t *testing.T) {
|
||||
// subtests here (Go 1.7 feature).
|
||||
testLookupA(t)
|
||||
testLookupSRV(t)
|
||||
}
|
||||
|
||||
func testLookupA(t *testing.T) {
|
||||
if !k8stest.CheckKubernetesRunning() {
|
||||
t.Skip("Skipping Kubernetes Integration tests. Kubernetes is not running")
|
||||
}
|
||||
|
||||
corefile :=
|
||||
`.:0 {
|
||||
kubernetes coredns.local {
|
||||
@@ -104,7 +98,7 @@ func testLookupA(t *testing.T) {
|
||||
|
||||
res, _, err := dnsClient.Exchange(dnsMessage, udp)
|
||||
if err != nil {
|
||||
t.Fatal("Could not send query: %s", err)
|
||||
t.Fatalf("Could not send query: %s", err)
|
||||
}
|
||||
// Count A records in the answer section
|
||||
ARecordCount := 0
|
||||
@@ -124,10 +118,6 @@ func testLookupA(t *testing.T) {
|
||||
}
|
||||
|
||||
func testLookupSRV(t *testing.T) {
|
||||
if !k8stest.CheckKubernetesRunning() {
|
||||
t.Skip("Skipping Kubernetes Integration tests. Kubernetes is not running")
|
||||
}
|
||||
|
||||
corefile :=
|
||||
`.:0 {
|
||||
kubernetes coredns.local {
|
||||
@@ -159,7 +149,7 @@ func testLookupSRV(t *testing.T) {
|
||||
|
||||
res, _, err := dnsClient.Exchange(dnsMessage, udp)
|
||||
if err != nil {
|
||||
t.Fatal("Could not send query: %s", err)
|
||||
t.Fatalf("Could not send query: %s", err)
|
||||
}
|
||||
// Count SRV records in the answer section
|
||||
srvRecordCount := 0
|
||||
|
||||
@@ -56,9 +56,9 @@ func TestLookupProxy(t *testing.T) {
|
||||
t.Error("Expected to at least one RR in the answer section, got none")
|
||||
}
|
||||
if resp.Answer[0].Header().Rrtype != dns.TypeA {
|
||||
t.Error("Expected RR to A, got: %d", resp.Answer[0].Header().Rrtype)
|
||||
t.Errorf("Expected RR to A, got: %d", resp.Answer[0].Header().Rrtype)
|
||||
}
|
||||
if resp.Answer[0].(*dns.A).A.String() != "127.0.0.1" {
|
||||
t.Error("Expected 127.0.0.1, got: %d", resp.Answer[0].(*dns.A).A.String())
|
||||
t.Errorf("Expected 127.0.0.1, got: %d", resp.Answer[0].(*dns.A).A.String())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user