Add upstream unit test (#1830)

Fix the upstream unit test to actually test it.
This commit is contained in:
Miek Gieben 2018-05-23 21:31:54 +01:00 committed by GitHub
parent 003e104fca
commit 1ae8a9e321
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,15 +28,14 @@ www 3600 IN CNAME www.example.net.
} }
defer rm() defer rm()
// Corefile with for example without proxy section. corefile := `.:0 {
corefile := `example.org:0 { file ` + name + ` example.org {
file ` + name + ` {
upstream upstream
} }
hosts { hosts {
10.0.0.1 www.example.net. 10.0.0.1 www.example.net.
fallthrough fallthrough
} }
} }
` `
i, udp, _, err := CoreDNSServerAndPorts(corefile) i, udp, _, err := CoreDNSServerAndPorts(corefile)
@ -56,5 +55,7 @@ www 3600 IN CNAME www.example.net.
if r.Rcode == dns.RcodeServerFailure { if r.Rcode == dns.RcodeServerFailure {
t.Fatalf("Rcode should not be 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)
}
} }