This commit is contained in:
crusader 2018-09-18 08:08:58 +09:00
parent baa4517f36
commit ab15aa25a3
3 changed files with 60 additions and 2 deletions

View File

@ -58,6 +58,14 @@ func Port(host *omd.Host, port int) *omd.Port {
) )
} }
func Service(port *omd.Port, metaCryptoTypeEnum omm.MetaCryptoTypeEnum, key string) *omd.Service {
return omd.NewService(
port,
omm.ToMetaCryptoType(metaCryptoTypeEnum),
key,
)
}
func DiscoveryConfig() *omd.DiscoveryConfig { func DiscoveryConfig() *omd.DiscoveryConfig {
return &omd.DiscoveryConfig{} return &omd.DiscoveryConfig{}
} }

View File

@ -6,10 +6,23 @@ import (
"testing" "testing"
omd "git.loafle.net/overflow/model/discovery" omd "git.loafle.net/overflow/model/discovery"
omm "git.loafle.net/overflow/model/meta"
ounp "git.loafle.net/overflow/util-go/net/ping" ounp "git.loafle.net/overflow/util-go/net/ping"
"git.loafle.net/overflow_scanner/probe/__test"
) )
func TestPing(t *testing.T) { func TestPing(t *testing.T) {
targetHost := __test.Host(
"",
"99",
"00:25:b3:fa:ca:9b",
)
targetPort := __test.Port(
targetHost,
7,
)
type args struct { type args struct {
service *omd.Service service *omd.Service
pingOption ounp.Option pingOption ounp.Option
@ -20,7 +33,19 @@ func TestPing(t *testing.T) {
want ounp.Result want ounp.Result
wantErr bool wantErr bool
}{ }{
// TODO: Add test cases. {
name: "192.168.1.99",
args: args{
service: __test.Service(
targetPort,
omm.MetaCryptoTypeEnumNONE,
"",
),
pingOption: &ounp.PingOption{
Retry: 3,
},
},
},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {

View File

@ -6,11 +6,24 @@ import (
"testing" "testing"
omd "git.loafle.net/overflow/model/discovery" omd "git.loafle.net/overflow/model/discovery"
omm "git.loafle.net/overflow/model/meta"
osm "git.loafle.net/overflow/service_matcher-go" osm "git.loafle.net/overflow/service_matcher-go"
ounp "git.loafle.net/overflow/util-go/net/ping" ounp "git.loafle.net/overflow/util-go/net/ping"
"git.loafle.net/overflow_scanner/probe/__test"
) )
func TestPing(t *testing.T) { func TestPing(t *testing.T) {
targetHost := __test.Host(
"",
"99",
"00:25:b3:fa:ca:9b",
)
targetPort := __test.Port(
targetHost,
80,
)
type args struct { type args struct {
service *omd.Service service *omd.Service
pingOption ounp.Option pingOption ounp.Option
@ -21,7 +34,19 @@ func TestPing(t *testing.T) {
want ounp.Result want ounp.Result
wantErr bool wantErr bool
}{ }{
// TODO: Add test cases. {
name: "192.168.1.99",
args: args{
service: __test.Service(
targetPort,
omm.MetaCryptoTypeEnumNONE,
"HTTP",
),
pingOption: &ounp.PingOption{
Retry: 3,
},
},
},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {