MCPcopy
hub / github.com/gliderlabs/ssh / newClientSession

Function newClientSession

session_test.go:40–64  ·  view source on GitHub ↗
(t *testing.T, addr string, config *gossh.ClientConfig)

Source from the content-addressed store, hash-verified

38}
39
40func newClientSession(t *testing.T, addr string, config *gossh.ClientConfig) (*gossh.Session, *gossh.Client, func()) {
41 if config == nil {
42 config = &gossh.ClientConfig{
43 User: "testuser",
44 Auth: []gossh.AuthMethod{
45 gossh.Password("testpass"),
46 },
47 }
48 }
49 if config.HostKeyCallback == nil {
50 config.HostKeyCallback = gossh.InsecureIgnoreHostKey()
51 }
52 client, err := gossh.Dial("tcp", addr, config)
53 if err != nil {
54 t.Fatal(err)
55 }
56 session, err := client.NewSession()
57 if err != nil {
58 t.Fatal(err)
59 }
60 return session, client, func() {
61 session.Close()
62 client.Close()
63 }
64}
65
66func newTestSession(t *testing.T, srv *Server, cfg *gossh.ClientConfig) (*gossh.Session, *gossh.Client, func()) {
67 l := newLocalListener()

Callers 3

TestServerShutdownFunction · 0.85
TestServerCloseFunction · 0.85
newTestSessionFunction · 0.85

Calls 1

CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…