Documentation ¶
Index ¶
- Variables
- func ConcatMultipleSlices[T any](slices [][]T) []T
- func RunCmd(devMaker deviceMaker, dialog []Action, commands []cmd.Cmd, logger *zap.Logger) (cmdRes []cmd.CmdRes, resErr, serverErr, err error)
- func RunDialog(t *testing.T, devMaker deviceMaker, dialog []Action, command, expected string, ...)
- func RunDialogWithDefaultCreds(t *testing.T, devMaker deviceMaker, dialog []Action, command, expected string)
- func RunInvalidDialog(t *testing.T, devMaker deviceMaker, dialog []Action, command string)
- func RunInvalidDialogWithException(t *testing.T, devMaker deviceMaker, dialog []Action, command string, ...)
- type Action
- type CloseAction
- type ExpectAction
- type MockSSHServer
- type MockSSHServerOption
- type SendAction
- type SendEchoAction
- type SleepAction
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrReadFailed = fmt.Errorf("failed to read data")
Functions ¶
func ConcatMultipleSlices ¶
func ConcatMultipleSlices[T any](slices [][]T) []T
func RunDialog ¶
func RunDialog(t *testing.T, devMaker deviceMaker, dialog []Action, command, expected string, creds credentials.Credentials)
func RunDialogWithDefaultCreds ¶ added in v1.0.15
func RunInvalidDialog ¶
Types ¶
type Action ¶
type Action interface {
Exec(reader io.ReadWriteCloser) error
}
type CloseAction ¶
type CloseAction struct{}
Close action
func Close ¶
func Close() CloseAction
func (CloseAction) Exec ¶
func (a CloseAction) Exec(c io.ReadWriteCloser) error
type ExpectAction ¶
type ExpectAction struct {
// contains filtered or unexported fields
}
Expect action
func Expect ¶
func Expect(data string) ExpectAction
func (ExpectAction) Exec ¶
func (a ExpectAction) Exec(c io.ReadWriteCloser) error
type MockSSHServer ¶
type MockSSHServer struct {
// contains filtered or unexported fields
}
func NewMockSSHServer ¶
func NewMockSSHServer(dialog []Action, opts ...MockSSHServerOption) (*MockSSHServer, error)
func (*MockSSHServer) GetAddress ¶
func (m *MockSSHServer) GetAddress() (string, int)
type MockSSHServerOption ¶
type MockSSHServerOption func(*MockSSHServer)
func WithLogger ¶
func WithLogger(logger *zap.Logger) MockSSHServerOption
func WithPassword ¶
func WithPassword(password string) MockSSHServerOption
func WithPrivateKey ¶
func WithPrivateKey(privateKey []byte) MockSSHServerOption
func WithUser ¶
func WithUser(username string) MockSSHServerOption
type SendAction ¶
type SendAction struct {
// contains filtered or unexported fields
}
Send action
func Send ¶
func Send(data string) SendAction
func (SendAction) Exec ¶
func (a SendAction) Exec(c io.ReadWriteCloser) error
type SendEchoAction ¶
type SendEchoAction struct {
// contains filtered or unexported fields
}
Send echo action
func SendEcho ¶
func SendEcho(data string) SendEchoAction
func (SendEchoAction) Exec ¶
func (a SendEchoAction) Exec(c io.ReadWriteCloser) error
type SleepAction ¶ added in v1.0.15
type SleepAction struct {
// contains filtered or unexported fields
}
Sleep action
func Sleep ¶ added in v1.0.15
func Sleep(count int) SleepAction
func (SleepAction) Exec ¶ added in v1.0.15
func (a SleepAction) Exec(c io.ReadWriteCloser) error
Click to show internal directories.
Click to hide internal directories.