2020-01-13 10:05:18 +00:00
|
|
|
package common
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestCheckRemoteSSH(t *testing.T) {
|
|
|
|
type args struct {
|
|
|
|
host string
|
|
|
|
port int
|
|
|
|
timeout int
|
|
|
|
}
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
args args
|
2020-01-14 09:58:05 +00:00
|
|
|
want error
|
2020-01-13 10:05:18 +00:00
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "test check localhost ssh port",
|
|
|
|
args: args{
|
|
|
|
host: "localhost",
|
|
|
|
port: 22,
|
|
|
|
timeout: 5,
|
|
|
|
},
|
2020-01-14 09:58:05 +00:00
|
|
|
want: nil,
|
2020-01-13 10:05:18 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
2020-01-14 09:58:05 +00:00
|
|
|
if got := CheckRemoteTCP(tt.args.host, tt.args.port, tt.args.timeout); got != tt.want {
|
2020-01-13 10:05:18 +00:00
|
|
|
t.Errorf("CheckRemoteSSH() = %v, want %v", got, tt.want)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|