aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-05-23 21:31:54 +0100
committerGravatar GitHub <noreply@github.com> 2018-05-23 21:31:54 +0100
commit1ae8a9e3219e29c0000848a8d2b1fb17faed8eb0 (patch)
tree5dfa5e6ff03a444d2bfd101e61687a880fc9edde /test
parent003e104fca728b0412fae2e139c84f416acf76ae (diff)
downloadcoredns-1ae8a9e3219e29c0000848a8d2b1fb17faed8eb0.tar.gz
coredns-1ae8a9e3219e29c0000848a8d2b1fb17faed8eb0.tar.zst
coredns-1ae8a9e3219e29c0000848a8d2b1fb17faed8eb0.zip
Add upstream unit test (#1830)
Fix the upstream unit test to actually test it.
Diffstat (limited to 'test')
-rw-r--r--test/file_upstream_test.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/file_upstream_test.go b/test/file_upstream_test.go
index 5a24e12c4..dc4cbc45f 100644
--- a/test/file_upstream_test.go
+++ b/test/file_upstream_test.go
@@ -28,15 +28,14 @@ www 3600 IN CNAME www.example.net.
}
defer rm()
- // Corefile with for example without proxy section.
- corefile := `example.org:0 {
- file ` + name + ` {
+ corefile := `.:0 {
+ file ` + name + ` example.org {
upstream
}
hosts {
- 10.0.0.1 www.example.net.
- fallthrough
- }
+ 10.0.0.1 www.example.net.
+ fallthrough
+ }
}
`
i, udp, _, err := CoreDNSServerAndPorts(corefile)
@@ -56,5 +55,7 @@ www 3600 IN CNAME www.example.net.
if r.Rcode == dns.RcodeServerFailure {
t.Fatalf("Rcode should not be dns.RcodeServerFailure")
}
- t.Logf("%s", r)
+ if x := r.Answer[1].(*dns.A).A.String(); x != "10.0.0.1" {
+ t.Errorf("Failed to get address for CNAME, expected 10.0.0.1 got %s", x)
+ }
}