Documentation
¶
Index ¶
- func ReadOnlyTestFS(fs vfs.FS) (vfs.FS, error)
- func TestFS(root any) (vfs.FS, func(), error)
- type Mounter
- func (e Mounter) GetMountPoints(device string) ([]mounter.MountPoint, error)
- func (e Mounter) GetMountRefs(pathname string) ([]string, error)
- func (e Mounter) IsMountPoint(file string) (bool, error)
- func (e Mounter) List() ([]mounter.MountPoint, error)
- func (e Mounter) Mount(source string, target string, fstype string, options []string) error
- func (e Mounter) Unmount(target string) error
- type Runner
- func (r *Runner) ClearCmds()
- func (r Runner) CmdsMatch(cmdList [][]string) error
- func (r Runner) EnvsMatch(envList [][]string) error
- func (r Runner) GetCmds() [][]string
- func (r Runner) GetLogger() log.Logger
- func (r Runner) IncludesCmds(cmdList [][]string) error
- func (r Runner) MatchMilestones(cmdList [][]string) error
- func (r *Runner) Run(command string, args ...string) ([]byte, error)
- func (r *Runner) RunContext(_ context.Context, command string, args ...string) ([]byte, error)
- func (r *Runner) RunContextParseOutput(_ context.Context, stdoutH, _ func(string), command string, args ...string) error
- func (r *Runner) RunEnv(command string, envs []string, args ...string) ([]byte, error)
- func (r *Runner) SetLogger(logger log.Logger)
- type Syscall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mounter ¶
FakeMounter is a fake mounter for tests that can error out.
func NewMounter ¶
func NewMounter() *Mounter
NewFakeMounter returns an FakeMounter with an instance of FakeMounter inside so we can use its functions
func (Mounter) GetMountPoints ¶
func (e Mounter) GetMountPoints(device string) ([]mounter.MountPoint, error)
type Runner ¶
type Runner struct {
ReturnValue []byte
SideEffect func(command string, args ...string) ([]byte, error)
ReturnError error
Logger log.Logger
// contains filtered or unexported fields
}
func (Runner) CmdsMatch ¶
CmdsMatch matches the commands list in order. Note HasPrefix is being used to evaluate the match, so expecting initial part of the command is enough to get a match. It facilitates testing commands with dynamic arguments (aka temporary files)
func (Runner) GetCmds ¶
GetCmds returns the list of commands recorded by this FakeRunner instance this is helpful to debug tests
func (Runner) IncludesCmds ¶
IncludesCmds checks the given commands were executed in any order. Note it uses HasPrefix to match commands, see CmdsMatch.
func (Runner) MatchMilestones ¶
MatchMilestones matches all the given commands were executed in the provided order. Note it uses HasPrefix to match commands, see CmdsMatch.
func (*Runner) RunContext ¶
func (*Runner) RunContextParseOutput ¶
type Syscall ¶
type Syscall struct {
ErrorOnChroot bool
// contains filtered or unexported fields
}
FakeSyscall is a test helper method to track calls to syscall It can also fail on Chroot command
func (*Syscall) Chroot ¶
Chroot will store the chroot call It can return a failure if ErrorOnChroot is true
func (*Syscall) WasChrootCalledWith ¶
WasChrootCalledWith is a helper method to check if Chroot was called with the given path