forked from scottkiss/gosshtool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tool_test.go
51 lines (46 loc) · 975 Bytes
/
tool_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package gosshtool
import (
"testing"
)
func Test_newSSHClinet(t *testing.T) {
/* config := &SSHClientConfig{
User: "s",
Password: "1223",
Host: "127.0.0.1",
}
sshclient := NewSSHClient(config)
stdout, stderr,session, err := sshclient.Cmd("pwd",nil,nil,0)
if err != nil {
t.Error(err)
}
t.Log(stdout)
t.Log(stderr)
stdout, stderr,session, err = sshclient.Cmd("ls",nil,nil,0)
t.Log(stdout)
t.Log("test")*/
}
func Test_mutiCmd(t *testing.T) {
/* config := &SSHClientConfig{
User: "jack",
Password: "assd",
Host: "31.11.11.11",
}
NewSSHClient(config)
config2 := &SSHClientConfig{
User: "asd",
Password: "daas",
Host: "8.8.8.8",
}
NewSSHClient(config2)
stdout, _, _,err := ExecuteCmd("pwd", "8.8.8.8")
if err != nil {
t.Error(err)
}
t.Log(stdout)
stdout, _,_, err = ExecuteCmd("pwd", "114.215.151.48")
if err != nil {
t.Error(err)
}
t.Log(stdout)*/
t.Log("test")
}