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

@ -48,6 +48,17 @@ func CoreDNSServerPorts(i *caddy.Instance, k int) (udp, tcp string) {
return
}
// CoreDNSServerAndPorts combines CoreDNSServer and CoreDNSServerPorts to start a CoreDNS
// server and returns the udp and tcp ports of the first instance.
func CoreDNSServerAndPorts(corefile string) (i *caddy.Instance, udp, tcp string, err error) {
i, err = CoreDNSServer(corefile)
if err != nil {
return nil, "", "", err
}
udp, tcp = CoreDNSServerPorts(i, 0)
return i, udp, tcp, nil
}
// Input implements the caddy.Input interface and acts as an easy way to use a string as a Corefile.
type Input struct {
corefile []byte