testutil

package
v0.13.7 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildContainerFromDir

func BuildContainerFromDir(t *testing.T, rootDir, imageName string) error

BuildContainerFromDir builds a container image from a directory

func CheckToolExists

func CheckToolExists(t *testing.T, tool string)

CheckToolExists checks if a required tool is available

func CleanupMounts

func CleanupMounts(t *testing.T, mountPoint string)

CleanupMounts unmounts any mounts under a directory

func CreateMockContainer

func CreateMockContainer(t *testing.T, imageName string) error

CreateMockContainer creates a minimal container image for testing

func RequireRoot

func RequireRoot(t *testing.T)

RequireRoot skips the test if not running as root

func RequireTools

func RequireTools(t *testing.T, tools ...string)

RequireTools checks for required tools and skips if any are missing

func WaitForDevice

func WaitForDevice(device string) error

WaitForDevice waits for a device to appear (useful after partitioning)

Types

type TestDisk

type TestDisk struct {
	ImagePath  string
	LoopDevice string
	Size       int64 // Size in bytes
	Mounted    bool
	// contains filtered or unexported fields
}

TestDisk represents a test disk image with loop device

func CreateTestDisk

func CreateTestDisk(t *testing.T, sizeGB int) (*TestDisk, error)

CreateTestDisk creates a disk image file and attaches it to a loop device

func (*TestDisk) Cleanup

func (d *TestDisk) Cleanup()

Cleanup detaches the loop device and removes the image file

func (*TestDisk) GetDevice

func (d *TestDisk) GetDevice() string

GetDevice returns the loop device path (e.g., /dev/loop0)

Jump to

Keyboard shortcuts

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