34 lines
587 B
Go
34 lines
587 B
Go
|
package common
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestCheckRemoteSSH(t *testing.T) {
|
||
|
type args struct {
|
||
|
host string
|
||
|
port int
|
||
|
timeout int
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want bool
|
||
|
}{
|
||
|
{
|
||
|
name: "test check localhost ssh port",
|
||
|
args: args{
|
||
|
host: "localhost",
|
||
|
port: 22,
|
||
|
timeout: 5,
|
||
|
},
|
||
|
want: true,
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := CheckRemoteSSH(tt.args.host, tt.args.port, tt.args.timeout); got != tt.want {
|
||
|
t.Errorf("CheckRemoteSSH() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|