aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Michael Richmond <mrichmon@users.noreply.github.com> 2016-07-22 16:07:27 -0700
committerGravatar GitHub <noreply@github.com> 2016-07-22 16:07:27 -0700
commit4a3b57d81b6c0f401fab7492e40307ac7a0c4c97 (patch)
tree51ee32285d9585127d1211411fe94454a70b9867 /test
parent3ba86f24211639a985d37f0c708e0a6dd30c862f (diff)
downloadcoredns-4a3b57d81b6c0f401fab7492e40307ac7a0c4c97.tar.gz
coredns-4a3b57d81b6c0f401fab7492e40307ac7a0c4c97.tar.zst
coredns-4a3b57d81b6c0f401fab7492e40307ac7a0c4c97.zip
Adding test cases for Corefile parsing (#193)
Adding test cases for Corefile parsing. Some code refactoring to allow test reuse.
Diffstat (limited to 'test')
-rw-r--r--test/kubernetes_test.go18
1 files changed, 5 insertions, 13 deletions
diff --git a/test/kubernetes_test.go b/test/kubernetes_test.go
index 6f6599d41..5f543836d 100644
--- a/test/kubernetes_test.go
+++ b/test/kubernetes_test.go
@@ -6,9 +6,9 @@ import (
"fmt"
"io/ioutil"
"log"
- "net/http"
"testing"
+ "github.com/miekg/coredns/middleware/kubernetes/k8stest"
"github.com/miekg/dns"
)
@@ -63,12 +63,6 @@ var testdataLookupSRV = []struct {
{"*.*.coredns.local.", 1, 1}, // One SRV record, via namespace and service wildcard
}
-// checkKubernetesRunning performs a basic
-func checkKubernetesRunning() bool {
- _, err := http.Get("http://localhost:8080/api/v1")
- return err == nil
-}
-
func TestK8sIntegration(t *testing.T) {
t.Log(" === RUN testLookupA")
testLookupA(t)
@@ -77,13 +71,12 @@ func TestK8sIntegration(t *testing.T) {
}
func testLookupA(t *testing.T) {
- if !checkKubernetesRunning() {
+ if !k8stest.CheckKubernetesRunning() {
t.Skip("Skipping Kubernetes Integration tests. Kubernetes is not running")
}
- // Note: Use different port to avoid conflict with servers used in other tests.
coreFile :=
- `.:2053 {
+ `.:0 {
kubernetes coredns.local {
endpoint http://localhost:8080
namespaces demo
@@ -128,13 +121,12 @@ func testLookupA(t *testing.T) {
}
func testLookupSRV(t *testing.T) {
- if !checkKubernetesRunning() {
+ if !k8stest.CheckKubernetesRunning() {
t.Skip("Skipping Kubernetes Integration tests. Kubernetes is not running")
}
- // Note: Use different port to avoid conflict with servers used in other tests.
coreFile :=
- `.:2054 {
+ `.:0 {
kubernetes coredns.local {
endpoint http://localhost:8080
namespaces demo