MCPcopy Create free account
hub / github.com/appleboy/easyssh-proxy / TestCommandTimeout

Function TestCommandTimeout

easyssh_test.go:503–517  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

501}
502
503func TestCommandTimeout(t *testing.T) {
504 ssh := &MakeConfig{
505 Server: "localhost",
506 User: "root",
507 Port: "22",
508 KeyPath: "./tests/.ssh/id_rsa",
509 }
510
511 outStr, errStr, isTimeout, err := ssh.Run("whoami; sleep 2", 1*time.Second)
512 assert.Equal(t, "root\n", outStr)
513 assert.Equal(t, "", errStr)
514 assert.False(t, isTimeout)
515 assert.NotNil(t, err)
516 assert.Equal(t, "Run Command Timeout: "+context.DeadlineExceeded.Error(), err.Error())
517}
518
519// TestProxyTimeoutHandling tests that timeout is properly respected when using proxy connections
520// This test uses a non-existent proxy server to force a timeout during proxy connection

Callers

nothing calls this directly

Calls 1

RunMethod · 0.95

Tested by

no test coverage detected