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
- type Config
- type Driver
- func (d *Driver) Delete(ctx context.Context, req *runtimev1.DeleteRequest) (*runtimev1.DeleteResponse, error)
- func (d *Driver) Exec(...) error
- func (d *Driver) Find(ctx context.Context, req *runtimev1.FindRequest) (*runtimev1.FindResponse, error)
- func (d *Driver) Info(context.Context, *runtimev1.InfoRequest) (*runtimev1.InfoResponse, error)
- func (d *Driver) Logs(req *runtimev1.LogsRequest, ...) error
- func (d *Driver) Preflight(ctx context.Context, _ *runtimev1.PreflightRequest) (*runtimev1.PreflightResponse, error)
- func (d *Driver) ProvisioningPreflight(ctx context.Context, _ *runtimev1.ProvisioningPreflightRequest) (*runtimev1.ProvisioningPreflightResponse, error)
- func (d *Driver) RunImage(ctx context.Context, req *runtimev1.RunImageRequest) (*runtimev1.RunImageResponse, error)
- func (d *Driver) Start(ctx context.Context, req *runtimev1.StartRequest) (*runtimev1.StartResponse, error)
- func (d *Driver) Stop(ctx context.Context, req *runtimev1.StopRequest) (*runtimev1.StopResponse, error)
- func (*Driver) TargetArchitecture(context.Context, *runtimev1.TargetArchitectureRequest) (*runtimev1.TargetArchitectureResponse, error)
Constants ¶
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 (*Driver) Delete ¶
func (d *Driver) Delete( ctx context.Context, req *runtimev1.DeleteRequest, ) (*runtimev1.DeleteResponse, error)
Delete succeeds even when the workspace is already absent.
func (*Driver) Exec ¶
func (d *Driver) Exec( stream grpc.BidiStreamingServer[runtimev1.ExecClientMessage, runtimev1.ExecServerMessage], ) error
Exec echoes stdin in bounded frames, or simulates a selected execution failure.
func (*Driver) Find ¶
func (d *Driver) Find( ctx context.Context, req *runtimev1.FindRequest, ) (*runtimev1.FindResponse, error)
Find returns ordinary absence without a gRPC error.
func (*Driver) Info ¶
func (d *Driver) Info(context.Context, *runtimev1.InfoRequest) (*runtimev1.InfoResponse, error)
Info reports supported capabilities or the selected discovery failure.
func (*Driver) Logs ¶
func (d *Driver) Logs( req *runtimev1.LogsRequest, stream grpc.ServerStreamingServer[runtimev1.OutputChunk], ) error
Logs returns deterministic merged binary output in bounded frames.
func (*Driver) Preflight ¶
func (d *Driver) Preflight( ctx context.Context, _ *runtimev1.PreflightRequest, ) (*runtimev1.PreflightResponse, error)
Preflight simulates dependency validation.
func (*Driver) ProvisioningPreflight ¶
func (d *Driver) ProvisioningPreflight( ctx context.Context, _ *runtimev1.ProvisioningPreflightRequest, ) (*runtimev1.ProvisioningPreflightResponse, error)
ProvisioningPreflight uses the same controllable failure as Preflight.
func (*Driver) RunImage ¶
func (d *Driver) RunImage( ctx context.Context, req *runtimev1.RunImageRequest, ) (*runtimev1.RunImageResponse, error)
RunImage creates a running workspace and rejects duplicate creation.
func (*Driver) Start ¶
func (d *Driver) Start( ctx context.Context, req *runtimev1.StartRequest, ) (*runtimev1.StartResponse, error)
Start normalizes an already-running workspace to success.
func (*Driver) Stop ¶
func (d *Driver) Stop( ctx context.Context, req *runtimev1.StopRequest, ) (*runtimev1.StopResponse, error)
Stop normalizes an already-stopped workspace to success.
func (*Driver) TargetArchitecture ¶
func (*Driver) TargetArchitecture( context.Context, *runtimev1.TargetArchitectureRequest, ) (*runtimev1.TargetArchitectureResponse, error)
TargetArchitecture returns a canonical architecture independent of the test host.