package e2etest¶
Package e2etest compiles and runs fixture-based tests for Unobin factories and libraries. Build-heavy cases are skipped by go test -short.
Functions¶
func RunCompiledCases¶
RunCompiledCases runs compiled-factory cases found under dir.
func RunSourceCases¶
RunSourceCases runs source-root cases found under dir.
Types¶
type AssetBundleCheck¶
type AssetCacheCheck¶
type AssetCacheCheck struct {
Path string `json:"path"`
ReferenceCount int `json:"referenceCount"`
}
type AssetIdentityCheck¶
type AssetIdentityCheck struct {
Asset string `json:"asset"`
StableEntry string `json:"stableEntry"`
ChangePath string `json:"changePath"`
ReplacementPath string `json:"replacementPath"`
}
type Command¶
type Command struct {
Name string `json:"name"`
Args []string `json:"args"`
Dir string `json:"dir"`
Env map[string]string `json:"env"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
Normalize string `json:"normalize"`
ExitCode int `json:"exitCode"`
SkipPin bool `json:"skipPin"`
TamperPlanFiles []string `json:"tamperPlanFiles"`
}
Command describes one subprocess invocation.
type CommandResult¶
CommandResult stores the process result for one command.
type CompiledCase¶
type CompiledCase struct {
Name string `json:"name"`
Dir string `json:"-"`
FactoryPath string `json:"factoryPath"`
LibraryPath string `json:"libraryPath"`
Build bool `json:"build"`
EmptyDirectories []string `json:"emptyDirectories"`
RemoveAfterCompile []string `json:"removeAfterCompile"`
AssetBundle *AssetBundleCheck `json:"assetBundle"`
AssetCache *AssetCacheCheck `json:"assetCache"`
AssetIdentity *AssetIdentityCheck `json:"assetIdentity"`
Commands []Command `json:"commands"`
Files []FileCheck `json:"files"`
FileExclusions []FileExclusionCheck `json:"fileExclusions"`
PlanSummaries []PlanSummaryCheck `json:"planSummaries"`
PlanEnvelopes []PlanEnvelopeCheck `json:"planEnvelopes"`
StateEnvelopes []StateEnvelopeCheck `json:"stateEnvelopes"`
AbsentFiles []string `json:"absentFiles"`
StateSummary string `json:"stateSummary"`
StateSeed string `json:"stateSeed"`
ExtraStateSnapshots int `json:"extraStateSnapshots"`
StateLocks []string `json:"stateLocks"`
Deterministic bool `json:"deterministic"`
}
CompiledCase describes a compiled-factory e2e case.
func DiscoverCompiledCases¶
DiscoverCompiledCases reads compiled-factory case.json files under dir.
type FileCheck¶
FileCheck describes a file compared to a golden.
type FileExclusionCheck¶
FileExclusionCheck rejects text in a generated text or binary file.
type GoLibrarySource¶
type GoLibrarySource struct {
Name string `json:"name"`
Resources []string `json:"resources"`
DataSources []string `json:"dataSources"`
Configuration bool `json:"configuration"`
}
type Option¶
Option configures e2e case execution.
func WithEnv¶
WithEnv adds environment variables to case commands, including automatic pinning. Variables declared by an individual command take precedence.
func WithGoModule¶
WithGoModule replaces a library module with a local directory when compiling cases.
func WithSourceDirectory¶
WithSourceDirectory copies a directory into source-case workspaces if absent.
func WithUnobinDir¶
WithUnobinDir selects a local Unobin checkout or module directory.
func WithUnobinExecutable¶
WithUnobinExecutable supplies the CLI used by source cases that run a process.
type PlanEnvelopeCheck¶
PlanEnvelopeCheck describes a plan envelope compared to a golden.
type PlanSummaryCheck¶
type PlanSummaryCheck struct {
Path string `json:"path"`
Want string `json:"want"`
IncludeInputs bool `json:"includeInputs"`
}
PlanSummaryCheck describes a plan file decoded and compared to a golden.
type RemoteSource¶
type RemoteSource struct {
Key string `json:"key"`
Path string `json:"path"`
Commit string `json:"commit"`
ProjectPath string `json:"projectPath"`
ProjectSubdir string `json:"projectSubdir"`
PackageSubdir string `json:"packageSubdir"`
SourcePath bool `json:"sourcePath"`
ModuleRootPath string `json:"moduleRootPath"`
ModulePath string `json:"modulePath"`
GoImportPath string `json:"goImportPath"`
}
RemoteSource describes a fake remote repository used by source-root cases.
type SourceCase¶
type SourceCase struct {
Name string `json:"name"`
Dir string `json:"-"`
RootPath string `json:"rootPath"`
Executor string `json:"executor"`
CLIVersion string `json:"cliVersion"`
Build bool `json:"build"`
Remotes []RemoteSource `json:"remotes"`
Tags map[string][]string `json:"tags"`
GoLibrary *GoLibrarySource `json:"goLibrary"`
Commands []Command `json:"commands"`
Files []FileCheck `json:"files"`
FileExclusions []FileExclusionCheck `json:"fileExclusions"`
AbsentFiles []string `json:"absentFiles"`
}
SourceCase describes a source-root CLI e2e case.
func DiscoverSourceCases¶
DiscoverSourceCases reads source-root case.json files under dir.
type StateEnvelopeCheck¶
StateEnvelopeCheck describes a current state envelope compared to a golden.