fsfixture

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package fsfixture provides the repository's kernel-backed controlled filesystem fault source as the distinct test source authorized by ADR-consumer-local-contracts-over-single-home-filesystem-access.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fault

type Fault struct {
	Operation Operation
	Path      string
	Err       error
}

Fault configures one operation and path to return Err.

type Handle

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

Handle is a kernel-backed filesystem handle with controlled faults.

func Open

func Open(root string, faults ...Fault) (*Handle, error)

Open opens root after validating controlled faults.

func (*Handle) Close

func (h *Handle) Close() error

Close closes the fixture root.

func (*Handle) Info

func (h *Handle) Info(path string) (fs.FileInfo, error)

Info returns metadata following a final symlink or its selected fault.

func (*Handle) LinkInfo

func (h *Handle) LinkInfo(path string) (fs.FileInfo, error)

LinkInfo returns metadata without following a final symlink or its selected fault.

func (*Handle) Read

func (h *Handle) Read(path string) ([]byte, error)

Read reads path or returns its selected fault.

func (*Handle) Walk

func (h *Handle) Walk(subtree string, visit func(string, fs.FileInfo) (bool, error)) error

Walk visits entries and applies configured traversal faults.

type Operation

type Operation string

Operation identifies a controllable filesystem operation.

const (
	// OperationWalk faults traversal before entry metadata is resolved.
	OperationWalk Operation = "walk"
	// OperationWalkInfo faults entry metadata resolution during traversal.
	OperationWalkInfo Operation = "walk-info"
	// OperationRead faults file reads.
	OperationRead Operation = "read"
	// OperationInfo faults final-symlink-following metadata reads.
	OperationInfo Operation = "info"
	// OperationLinkInfo faults final-symlink-preserving metadata reads.
	OperationLinkInfo Operation = "link-info"
)

Jump to

Keyboard shortcuts

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