ing
This commit is contained in:
parent
baa4517f36
commit
ab15aa25a3
|
@ -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 {
|
||||
return &omd.DiscoveryConfig{}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,23 @@ import (
|
|||
"testing"
|
||||
|
||||
omd "git.loafle.net/overflow/model/discovery"
|
||||
omm "git.loafle.net/overflow/model/meta"
|
||||
ounp "git.loafle.net/overflow/util-go/net/ping"
|
||||
"git.loafle.net/overflow_scanner/probe/__test"
|
||||
)
|
||||
|
||||
func TestPing(t *testing.T) {
|
||||
targetHost := __test.Host(
|
||||
"",
|
||||
"99",
|
||||
"00:25:b3:fa:ca:9b",
|
||||
)
|
||||
|
||||
targetPort := __test.Port(
|
||||
targetHost,
|
||||
7,
|
||||
)
|
||||
|
||||
type args struct {
|
||||
service *omd.Service
|
||||
pingOption ounp.Option
|
||||
|
@ -20,7 +33,19 @@ func TestPing(t *testing.T) {
|
|||
want ounp.Result
|
||||
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 {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
|
@ -6,11 +6,24 @@ import (
|
|||
"testing"
|
||||
|
||||
omd "git.loafle.net/overflow/model/discovery"
|
||||
omm "git.loafle.net/overflow/model/meta"
|
||||
osm "git.loafle.net/overflow/service_matcher-go"
|
||||
ounp "git.loafle.net/overflow/util-go/net/ping"
|
||||
"git.loafle.net/overflow_scanner/probe/__test"
|
||||
)
|
||||
|
||||
func TestPing(t *testing.T) {
|
||||
targetHost := __test.Host(
|
||||
"",
|
||||
"99",
|
||||
"00:25:b3:fa:ca:9b",
|
||||
)
|
||||
|
||||
targetPort := __test.Port(
|
||||
targetHost,
|
||||
80,
|
||||
)
|
||||
|
||||
type args struct {
|
||||
service *omd.Service
|
||||
pingOption ounp.Option
|
||||
|
@ -21,7 +34,19 @@ func TestPing(t *testing.T) {
|
|||
want ounp.Result
|
||||
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 {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user