67 lines
1.4 KiB
Go
67 lines
1.4 KiB
Go
package snmp
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
|
|
omcc "git.loafle.net/overflow/model/config/credential"
|
|
"git.loafle.net/overflow_scanner/probe/__test"
|
|
"git.loafle.net/overflow_scanner/probe/discovery/session"
|
|
"git.loafle.net/overflow_scanner/probe/discovery/types"
|
|
)
|
|
|
|
func TestScan(t *testing.T) {
|
|
s := session.NewMockDiscoverySession(
|
|
"testRequester",
|
|
types.DiscoveryRequestTypeHost,
|
|
__test.Zone(),
|
|
__test.DiscoverHost(__test.DiscoveryConfig(), 1, 254, nil),
|
|
)
|
|
|
|
type args struct {
|
|
discoverySession session.DiscoverySession
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
wantErr bool
|
|
}{
|
|
{
|
|
name: "1",
|
|
args: args{
|
|
discoverySession: s,
|
|
},
|
|
wantErr: false,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if err := Scan(tt.args.discoverySession); (err != nil) != tt.wantErr {
|
|
t.Errorf("Scan() error = %v, wantErr %v", err, tt.wantErr)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_scanV2(t *testing.T) {
|
|
type args struct {
|
|
target net.IP
|
|
discoverySession session.DiscoverySession
|
|
credential *omcc.SNMPCredential
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want bool
|
|
}{
|
|
// TODO: Add test cases.
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := scanV2(tt.args.target, tt.args.discoverySession, tt.args.credential); got != tt.want {
|
|
t.Errorf("scanV2() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|