MCPcopy Index your code
hub / github.com/ContainerSSH/ContainerSSH / TestSessionSuccess

Function TestSessionSuccess

internal/sshserver/Server_test.go:212–245  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

210}
211
212func TestSessionSuccess(t *testing.T) {
213 //t.Parallel()()
214 port := test.GetNextPort(t, "SSH")
215 server := newServerHelper(
216 t,
217 fmt.Sprintf("127.0.0.1:%d", port),
218 map[string][]byte{
219 "foo": []byte("bar"),
220 },
221 map[string]string{},
222 )
223 hostKey, err := server.start(t)
224 if err != nil {
225 assert.Fail(t, "failed to start ssh server", err)
226 return
227 }
228 defer func() {
229 server.stop()
230 <-server.shutdownChannel
231 }()
232
233 reply, exitStatus, err := shellRequestReply(
234 fmt.Sprintf("127.0.0.1:%d", port),
235 "foo",
236 ssh.Password("bar"),
237 hostKey,
238 []byte("Hi"),
239 nil,
240 nil,
241 )
242 assert.Equal(t, []byte("Hello world!"), reply)
243 assert.Equal(t, 0, exitStatus)
244 assert.Equal(t, nil, err)
245}
246
247func TestSessionError(t *testing.T) {
248 //t.Parallel()()

Callers

nothing calls this directly

Calls 7

GetNextPortFunction · 0.92
newServerHelperFunction · 0.85
shellRequestReplyFunction · 0.85
FailMethod · 0.80
stopMethod · 0.80
startMethod · 0.65
PasswordMethod · 0.65

Tested by

no test coverage detected