Documentation
¶
Overview ¶
Package itest holds the parts of the integration test that can be unit tested: collecting specs, the sandbox module, running and building jobs, the result cache, known failures and the report.
Index ¶
- Constants
- Variables
- func Exec(ctx context.Context, dir, name string, args ...string) ([]byte, error)
- func HashFiles(paths ...string) (string, error)
- func Key(job Job) (string, error)
- func Report(results []Result) string
- func SafeNames(names []string) []string
- type Cache
- type Command
- type Job
- type Result
- type Runner
- type Sandbox
- type Spec
- type Variant
Constants ¶
const ( StageGenerate = "generate" StageBuild = "build" StageTest = "test" )
Stages a job can fail at.
Variables ¶
Functions ¶
func Key ¶
Key is the cache key of job: the hash of its spec file, its variant name, and a hash of the config it is generated with and the call it is checked with, so a changed variant runs again.
Types ¶
type Cache ¶
Cache holds the keys of the jobs that passed with one build of the tool, Tool being its hash. A tool with another hash starts with an empty cache, so there is no expiry.
type Job ¶
Job is one spec generated with one variant into Package, a folder of the sandbox with forward slashes whose last element is the Go package name.
type Result ¶
type Result struct {
Job Job
Stage string
Output string
Lines int
Elapsed time.Duration
IsCached bool
}
Result is how a job went: an empty Stage means it passed. Output is what the failing step printed. Lines counts the generated lines.
type Runner ¶
type Runner struct {
Exec Command
Sandbox Sandbox
Tool string
Timeout time.Duration
Concurrency int
BatchSize int
// contains filtered or unexported fields
}
Runner generates jobs with the CLI at Tool and builds what they generate in the sandbox.
type Sandbox ¶
Sandbox is the Go module in Dir that generated packages are built in. It replaces the mockzilla-codegen module with Repo, so generated code imports the runtime of the tree under test.
type Spec ¶
Spec is one spec file a run generates from. Name is the path relative to the specs folder, or to the repo when the file is outside it, with forward slashes.
type Variant ¶
type Variant struct {
Name string
Config string
Files map[string][]string
Init string
Imports []string
}
Variant is one config every spec is generated with. Config is YAML added to the package and output keys the runner writes. Files are the entries of output.files, the selectors of the parts each file gets. Init, when set, is a call the runner makes on every package once it builds, with %s standing for the package, such as %s.NewRouter(nil); a panic fails the job. Imports are the other packages Init names.