Documentation
¶
Overview ¶
Package adaptertest provides a recording fake of adapter.Backend for tests. It replaces the old fake-tmux-binary harness: instead of grepping a shell log of tmux argv, tests assert directly on the recorded backend calls.
Index ¶
- type Backend
- func (b *Backend) AttachArgv(name string) ([]string, error)
- func (b *Backend) Calls() []Call
- func (b *Backend) CallsOf(op string) []Call
- func (b *Backend) Capture(_ context.Context, name string, lines int) (string, error)
- func (b *Backend) CommandLog() string
- func (b *Backend) CreateProviderSession(_ context.Context, spec session.CreateSpec) error
- func (b *Backend) HasSession(_ context.Context, name string) bool
- func (b *Backend) Kill(_ context.Context, name string) error
- func (b *Backend) List(_ context.Context) ([]session.Info, error)
- func (b *Backend) SendLine(_ context.Context, name, text string) error
- func (b *Backend) SendPrompt(_ context.Context, name, text string) error
- func (b *Backend) SetSessionLabel(_ context.Context, name, label string) error
- type Call
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// Sessions is returned by List.
Sessions []session.Info
// CaptureText is returned by Capture.
CaptureText string
CreateErr error
ListErr error
CaptureErr error
SendErr error
KillErr error
LabelErr error
HasResult bool
AttachExe string
// contains filtered or unexported fields
}
Backend is an in-memory adapter.Backend that records every call and serves configurable results.
func (*Backend) CommandLog ¶
CommandLog renders the created sessions' argv as lines, for substring asserts equivalent to the old fake-tmux log greps.
func (*Backend) CreateProviderSession ¶
func (*Backend) SendPrompt ¶
SendPrompt records as a "send" call: tests assert on what was typed, not on the readiness wait the real host performs.
Click to show internal directories.
Click to hide internal directories.