2018-08-12 10:24:23 +00:00
|
|
|
package ping
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestPing(t *testing.T) {
|
|
|
|
|
|
|
|
ip := "192.168.1.229"
|
|
|
|
port := 6379
|
|
|
|
portType := "TCP"
|
|
|
|
key := "REDIS"
|
|
|
|
tls := false
|
|
|
|
|
2018-08-15 06:18:40 +00:00
|
|
|
ch := make(chan *Res)
|
2018-08-12 10:24:23 +00:00
|
|
|
Ping(ch, ip, port, tls, portType, key)
|
|
|
|
|
|
|
|
for res := range ch {
|
|
|
|
if res.Error != nil {
|
|
|
|
t.Error(res.Error)
|
|
|
|
} else {
|
|
|
|
t.Log(res.Matcher.Name())
|
|
|
|
t.Log(res.Matcher.Meta())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|