tests: CoreDNSServerAndPorts (#972)

* tests: CoreDNSServerAndPorts

Copy from kubernetes.go and renamed to fit the style, adapted almost
all callers.

This is a mechanicl change, no testdata was changed.

* typos
This commit is contained in:
Miek Gieben 2017-08-24 11:35:14 +01:00 committed by GitHub
parent ea53f8c219
commit f901b0cefa
24 changed files with 39 additions and 143 deletions

View file

@ -51,15 +51,10 @@ func TestProxyWithHTTPCheckOK(t *testing.T) {
}
`
authoritativeInstance, err := CoreDNSServer(authoritativeCorefile)
authoritativeInstance, authoritativeAddr, _, err := CoreDNSServerAndPorts(authoritativeCorefile)
if err != nil {
t.Fatalf("Could not get CoreDNS authoritative instance: %s", err)
}
authoritativeAddr, _ := CoreDNSServerPorts(authoritativeInstance, 0)
if authoritativeAddr == "" {
t.Fatalf("Could not get CoreDNS authoritative instance UDP listening port")
}
defer authoritativeInstance.Stop()
proxyCorefile := `example.org:0 {
@ -70,15 +65,10 @@ func TestProxyWithHTTPCheckOK(t *testing.T) {
}
`
proxyInstance, err := CoreDNSServer(proxyCorefile)
proxyInstance, proxyAddr, _, err := CoreDNSServerAndPorts(proxyCorefile)
if err != nil {
t.Fatalf("Could not get CoreDNS proxy instance: %s", err)
}
proxyAddr, _ := CoreDNSServerPorts(proxyInstance, 0)
if proxyAddr == "" {
t.Fatalf("Could not get CoreDNS proxy instance UDP listening port")
}
defer proxyInstance.Stop()
p := proxy.NewLookup([]string{proxyAddr})