recordertest

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package recordertest is the scripted recorder.Engine every recorder test drives: sessions and recordings that record their calls, an optional gate that holds OpenSession (the output picker), and a hook that ends a recording as a failed capture would.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// OpenErr and StartErr fail the respective step; StopErr is what
	// every recording's Stop returns.
	OpenErr, StartErr, StopErr error
	// Gate, when set, holds OpenSession until it closes or ctx ends.
	Gate chan struct{}
	// WriteOutput makes a stopped recording leave a non-empty file at
	// its output path, as a finalized muxer does.
	WriteOutput bool
	// contains filtered or unexported fields
}

Engine is a fake recorder.Engine.

func (*Engine) OpenOutput added in v0.3.15

func (e *Engine) OpenOutput(output string, _ bool) (recorder.Session, error)

OpenOutput implements recorder.Engine.

func (*Engine) OpenSession

func (e *Engine) OpenSession(ctx context.Context, _ bool) (recorder.Session, error)

OpenSession implements recorder.Engine.

func (*Engine) Outputs added in v0.3.15

func (e *Engine) Outputs() []string

Outputs are the outputs OpenOutput was asked for.

func (*Engine) Recordings

func (e *Engine) Recordings() []*Recording

Recordings are the started recordings.

func (*Engine) Replays added in v0.3.15

func (e *Engine) Replays() []*Replay

Replays are the started replays.

func (*Engine) Sessions

func (e *Engine) Sessions() []*Session

Sessions are the opened sessions.

type Recording

type Recording struct {
	// Opts are the options it started with.
	Opts recorder.Options
	// contains filtered or unexported fields
}

Recording is a fake recorder.Recording.

func (*Recording) Fail

func (r *Recording) Fail(reason string)

Fail ends the recording on its own, as a dying capture reports.

func (*Recording) HoldStop

func (r *Recording) HoldStop() (release func())

HoldStop makes Stop block until release runs, so a test can see what the service shows while a recording finalizes.

func (*Recording) Paused

func (r *Recording) Paused() []bool

Paused lists the SetPaused arguments.

func (*Recording) SetPaused

func (r *Recording) SetPaused(paused bool)

SetPaused implements recorder.Recording.

func (*Recording) Stop

func (r *Recording) Stop() error

Stop implements recorder.Recording.

func (*Recording) Stops

func (r *Recording) Stops() int

Stops counts Stop calls.

type Replay added in v0.3.15

type Replay struct {
	// Opts and Span are what it started with.
	Opts recorder.Options
	Span time.Duration
	// contains filtered or unexported fields
}

Replay is a fake recorder.Replay: Save writes the path and format it was asked for into the file, as a muxed ring would write footage.

func (*Replay) Bytes added in v0.3.15

func (r *Replay) Bytes() uint64

Bytes implements recorder.Replay.

func (*Replay) Fail added in v0.3.15

func (r *Replay) Fail(reason string)

Fail ends the replay on its own, as a dying capture reports.

func (*Replay) FailSaves added in v0.3.15

func (r *Replay) FailSaves(err error)

FailSaves makes every following Save fail with err.

func (*Replay) Keyframe added in v0.3.15

func (r *Replay) Keyframe(n uint64)

Keyframe makes the ring hold n bytes and reports a keyframe entering it.

func (*Replay) Save added in v0.3.15

func (r *Replay) Save(path string, format config.RecorderFormat) error

Save implements recorder.Replay.

func (*Replay) Saves added in v0.3.15

func (r *Replay) Saves() []string

Saves are the paths saved to.

func (*Replay) Stop added in v0.3.15

func (r *Replay) Stop() error

Stop implements recorder.Replay.

func (*Replay) Stops added in v0.3.15

func (r *Replay) Stops() int

Stops counts Stop calls.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is a fake recorder.Session.

func (*Session) Close

func (s *Session) Close()

Close implements recorder.Session.

func (*Session) Closed

func (s *Session) Closed() int

Closed counts Close calls.

func (*Session) Start added in v0.2.0

func (s *Session) Start(opts recorder.Options, term func(string)) (recorder.Recording, error)

Start implements recorder.Session.

func (*Session) StartReplay added in v0.3.15

func (s *Session) StartReplay(opts recorder.Options, span time.Duration, term func(string), onKey func()) (recorder.Replay, error)

StartReplay implements recorder.Session.

Jump to

Keyboard shortcuts

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