sshrunnertest

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sshrunnertest is a scripted runner every engine's tests drive a node with.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fake

type Fake struct {
	Respond func(line string) *sshrunner.Result
	// Started hands one session to each started command in order.
	Started []*Session
	// StartErr refuses every command started past the ones Started scripts.
	StartErr error
	// contains filtered or unexported fields
}

Fake records the command lines it is given and answers them from Respond.

func (*Fake) Close

func (f *Fake) Close() error

func (*Fake) Contexts

func (f *Fake) Contexts() []context.Context

Contexts returns the context each started command was bound to, which is its lifetime.

func (*Fake) Dial

func (f *Fake) Dial(context.Context, string, string) (net.Conn, error)

func (*Fake) Files

func (f *Fake) Files(context.Context) (sshrunner.Files, error)

func (*Fake) Lines

func (f *Fake) Lines() []string

Lines returns the command lines the engine has sent so far.

func (*Fake) Options

func (f *Fake) Options() []*sshrunner.StartOptions

Options returns the stream shape the engine asked each started command for.

func (*Fake) Ping added in v0.1.4

func (f *Fake) Ping(ctx context.Context) error

func (*Fake) Run

func (f *Fake) Run(ctx context.Context, line string, _ io.Reader) (*sshrunner.Result, error)

func (*Fake) Start

func (f *Fake) Start(ctx context.Context, line string, opts *sshrunner.StartOptions) (sshrunner.Session, error)

type Session

type Session struct {
	Code int
	Out  string
	Err  string
	Hold <-chan struct{}
	// contains filtered or unexported fields
}

Session is one scripted command with its exit code and output.

func (*Session) Close

func (s *Session) Close() error

func (*Session) Closed

func (s *Session) Closed() bool

Closed reports whether the engine has released the session.

func (*Session) In

func (s *Session) In() string

In returns what the engine has written to the session's stdin.

func (*Session) Resize

func (s *Session) Resize(uint, uint) error

func (*Session) Stderr

func (s *Session) Stderr() io.ReadCloser

func (*Session) Stdin

func (s *Session) Stdin() io.WriteCloser

func (*Session) Stdout

func (s *Session) Stdout() io.ReadCloser

func (*Session) Wait

func (s *Session) Wait() (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL