You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
384 B
26 lines
384 B
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestSSH(tt *testing.T) {
|
|
host := "172.16.0.5"
|
|
port := "22"
|
|
user := "root"
|
|
passwd := "123456"
|
|
cmd := "top -c -b -n 1"
|
|
sshClient, err := getClient(host, port, user, passwd)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
defer sshClient.Close()
|
|
res, err := SSH(sshClient, cmd)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
fmt.Println(res)
|
|
|
|
}
|