fake

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package fake provides a persistent runtime fixture for real protocol tests. A state directory must have only one active Driver owner at a time.

Index

Constants

View Source
const (
	Normal               = "normal"
	Conformance          = "conformance"
	CrashBeforeHandshake = "crash-before-handshake"
	CrashAfterHandshake  = "crash-after-handshake"
	DelayHandshake       = "delay-handshake"
	IncompatibleVersion  = "incompatible-version"
	MalformedInfo        = "malformed-info"
	FailPreflight        = "fail-preflight"
	FailRun              = "fail-run"
	NotFound             = "not-found"
	ExecEcho             = "exec-echo"
	ExecNonzero          = "exec-nonzero"
	ExecCrash            = "exec-crash"
	ExecSlow             = "exec-slow"
	Logs                 = "logs"
)

Modes are deterministic failure and streaming scenarios selected at startup.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	StateDir string
	Mode     string
	// MountTypes defaults to all when nil; an empty slice advertises no mounts.
	MountTypes []runtimev1.MountType
}

Config controls fixture behavior. StateDir is required and persists across launches.

type Driver

type Driver struct {
	runtimev1.UnimplementedRuntimeDriverServer
	// contains filtered or unexported fields
}

Driver implements the protocol without launching a real container or command. Exec echoes bytes rather than interpreting argv or running a shell.

func New

func New(config Config) (*Driver, error)

New validates configuration and creates a private state directory.

func (*Driver) Delete

Delete succeeds even when the workspace is already absent.

func (*Driver) Exec

Exec echoes stdin in bounded frames, or simulates a selected execution failure.

func (*Driver) Find

Find returns ordinary absence without a gRPC error.

func (*Driver) Info

Info reports supported capabilities or the selected discovery failure.

func (*Driver) Logs

Logs returns deterministic merged binary output in bounded frames.

func (*Driver) Preflight

Preflight simulates dependency validation.

func (*Driver) ProvisioningPreflight

ProvisioningPreflight uses the same controllable failure as Preflight.

func (*Driver) RunImage

RunImage creates a running workspace and rejects duplicate creation.

func (*Driver) Start

Start normalizes an already-running workspace to success.

func (*Driver) Stop

Stop normalizes an already-stopped workspace to success.

func (*Driver) TargetArchitecture

TargetArchitecture returns a canonical architecture independent of the test host.

Jump to

Keyboard shortcuts

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