refactor pkg/probe ProbeRunners to interfaces and move global probers into kubelet field for testability

This commit is contained in:
Mike Danese
2015-02-08 12:19:34 -08:00
parent 043794492e
commit 3d0cd81feb
5 changed files with 52 additions and 28 deletions

View File

@@ -27,12 +27,16 @@ import (
)
func New() TCPProber {
return TCPProber{}
return tcpProber{}
}
type TCPProber struct{}
type TCPProber interface {
Probe(host string, port int, timeout time.Duration) (probe.Result, error)
}
func (pr TCPProber) Probe(host string, port int, timeout time.Duration) (probe.Result, error) {
type tcpProber struct{}
func (pr tcpProber) Probe(host string, port int, timeout time.Duration) (probe.Result, error) {
return DoTCPProbe(net.JoinHostPort(host, strconv.Itoa(port)), timeout)
}