vmtest

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 7 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 vmtest is a vm.Backend for tests: VMs in memory, every call recorded.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fake

type Fake struct {
	VMs   map[string]*vm.Instance
	Calls []string
	// Err, when set, is what every call returns.
	Err error
	// FailOn is what the calls of an operation return ("clone", "edit"...).
	FailOn map[string]error
	// Sticky VMs survive Delete, and stay running after Stop.
	Sticky map[string]bool
	// Shell answers Shell calls; exit status 0 when nil.
	ShellFunc func(name string, o vm.ShellOpts) int
	// contains filtered or unexported fields
}

Fake keeps its VMs in memory.

func New

func New(vms ...*vm.Instance) *Fake

New is a Fake holding vms.

func (*Fake) CallLog

func (f *Fake) CallLog() string

CallLog is the calls, one per line.

func (*Fake) Clone

func (f *Fake) Clone(_ context.Context, from, to string) error

func (*Fake) Create

func (f *Fake) Create(_ context.Context, name, template string, s vm.Settings, _ io.Writer) error

func (*Fake) Delete

func (f *Fake) Delete(_ context.Context, name string) error

func (*Fake) Edit

func (f *Fake) Edit(_ context.Context, name string, s vm.Settings) error

func (*Fake) Get

func (f *Fake) Get(_ context.Context, name string) (*vm.Instance, error)

func (*Fake) List

func (f *Fake) List(context.Context) ([]*vm.Instance, error)

func (*Fake) Shell

func (f *Fake) Shell(_ context.Context, name string, o vm.ShellOpts) (int, error)

func (*Fake) Start

func (f *Fake) Start(_ context.Context, name string, _ io.Writer) error

func (*Fake) Stop

func (f *Fake) Stop(_ context.Context, name string) error

Jump to

Keyboard shortcuts

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