MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / TestSessionError

Function TestSessionError

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

Source from the content-addressed store, hash-verified

245}
246
247func TestSessionError(t *testing.T) {
248 //t.Parallel()()
249 port := test.GetNextPort(t, "SSH")
250 server := newServerHelper(
251 t,
252 fmt.Sprintf("127.0.0.1:%d", port),
253 map[string][]byte{
254 "foo": []byte("bar"),
255 },
256 map[string]string{},
257 )
258 hostKey, err := server.start(t)
259 if err != nil {
260 assert.Fail(t, "failed to start ssh server", err)
261 return
262 }
263 defer func() {
264 server.stop()
265 <-server.shutdownChannel
266 }()
267
268 reply, exitStatus, err := shellRequestReply(
269 fmt.Sprintf("127.0.0.1:%d", port),
270 "foo",
271 ssh.Password("bar"),
272 hostKey,
273 []byte("Ho"),
274 nil,
275 nil,
276 )
277 assert.Equal(t, 1, exitStatus)
278 assert.Equal(t, []byte{}, reply)
279 assert.Equal(t, nil, err)
280}
281
282func TestPubKey(t *testing.T) {
283 //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