probe/ping/host/host_test.go
2018-09-20 14:57:30 +09:00

52 lines
962 B
Go

package host
import (
"reflect"
"testing"
omd "git.loafle.net/overflow/model/discovery"
ounp "git.loafle.net/overflow/util-go/net/ping"
"git.loafle.net/overflow_scanner/probe/__test"
)
func TestPing(t *testing.T) {
type args struct {
host *omd.Host
pingOption ounp.Option
}
tests := []struct {
name string
args args
want ounp.Result
wantErr bool
}{
{
name: "192.168.1.1",
args: args{
host: __test.Host(
"atGame",
"1",
"00:11:32:7f:20:61",
),
pingOption: &ounp.PingOption{
Count: 3,
Interval: 1,
Deadline: 1,
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Ping(tt.args.host, tt.args.pingOption)
if (err != nil) != tt.wantErr {
t.Errorf("Ping() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Ping() = %v, want %v", got, tt.want)
}
})
}
}