Documentation
¶
Index ¶
- func ValidateSnapshot(t *testing.T, actual, expected *FileSystemSnapshot)
- type FileSystemSnapshot
- type RegistryEntry
- type TestContainer
- func (tc *TestContainer) CaptureSnapshot(rootPath string) (*FileSystemSnapshot, error)
- func (tc *TestContainer) CheckDirExists(path string) (bool, error)
- func (tc *TestContainer) CheckFileExists(path string) (bool, error)
- func (tc *TestContainer) Cleanup()
- func (tc *TestContainer) CopyDirToContainer(sourceDir, targetDir string) error
- func (tc *TestContainer) CopyToContainer(sourcePath, targetPath string) error
- func (tc *TestContainer) CreateRegistryConfig(configPath string, scaffolds []RegistryEntry) error
- func (tc *TestContainer) ListDirectory(path string) ([]string, error)
- func (tc *TestContainer) ReadFile(path string) (string, error)
- func (tc *TestContainer) Reset() error
- func (tc *TestContainer) RunScaffold(args ...string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateSnapshot ¶
func ValidateSnapshot(t *testing.T, actual, expected *FileSystemSnapshot)
ValidateSnapshot compares actual snapshot with expected
Types ¶
type FileSystemSnapshot ¶
type FileSystemSnapshot struct {
Files map[string]string // path -> content
Dirs []string // directory paths
}
FileSystemSnapshot captures the state of a directory tree
func LoadExpectedSnapshot ¶
func LoadExpectedSnapshot(fixtureDir string) (*FileSystemSnapshot, error)
LoadExpectedSnapshot loads expected output from fixtures
type RegistryEntry ¶
RegistryEntry represents a scaffold registry entry
type TestContainer ¶
type TestContainer struct {
// contains filtered or unexported fields
}
TestContainer wraps container operations for testing
func NewSharedContainer ¶
func NewSharedContainer() (*TestContainer, error)
NewSharedContainer creates a container for reuse across multiple tests. Unlike NewTestContainer, this doesn't take a testing.T since it's called from TestMain before any individual tests run.
func NewTestContainer ¶
func NewTestContainer(t *testing.T) (*TestContainer, error)
NewTestContainer creates a new Alpine container for testing
func (*TestContainer) CaptureSnapshot ¶
func (tc *TestContainer) CaptureSnapshot(rootPath string) (*FileSystemSnapshot, error)
CaptureSnapshot captures the filesystem state in the container
func (*TestContainer) CheckDirExists ¶
func (tc *TestContainer) CheckDirExists(path string) (bool, error)
CheckDirExists checks if a directory exists in the container
func (*TestContainer) CheckFileExists ¶
func (tc *TestContainer) CheckFileExists(path string) (bool, error)
CheckFileExists checks if a file exists in the container
func (*TestContainer) CopyDirToContainer ¶
func (tc *TestContainer) CopyDirToContainer(sourceDir, targetDir string) error
CopyDirToContainer copies a directory to the container
func (*TestContainer) CopyToContainer ¶
func (tc *TestContainer) CopyToContainer(sourcePath, targetPath string) error
CopyToContainer copies files to the container
func (*TestContainer) CreateRegistryConfig ¶
func (tc *TestContainer) CreateRegistryConfig(configPath string, scaffolds []RegistryEntry) error
CreateRegistryConfig creates a scaffold registry config file in the container
func (*TestContainer) ListDirectory ¶
func (tc *TestContainer) ListDirectory(path string) ([]string, error)
ListDirectory lists files in a container directory
func (*TestContainer) ReadFile ¶
func (tc *TestContainer) ReadFile(path string) (string, error)
ReadFile reads a file from the container
func (*TestContainer) Reset ¶
func (tc *TestContainer) Reset() error
Reset clears container state between tests. This removes all test artifacts while keeping the container, binary, and mounted templates intact. Note: /root/.config/guild/templates is a bind mount and preserved across resets.
func (*TestContainer) RunScaffold ¶
func (tc *TestContainer) RunScaffold(args ...string) (string, error)
RunScaffold runs the scaffold command in the container