Documentation
¶
Overview ¶
Package scenarios provides a shared scenario catalog consumable by both Go tests and the Ruby integration harness.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Catalog ¶
type Catalog struct {
Version int `yaml:"version"`
Categories []Category `yaml:"categories"`
Scenarios []Scenario `yaml:"scenarios"`
}
Catalog is the top-level structure of catalog.yml.
func Load ¶
Load reads the catalog from the canonical location relative to this package's source file. Suitable for use in tests.
func (*Catalog) ByCategory ¶
ByCategory returns scenarios matching the given category name.
type Expect ¶
type Expect struct {
Exit *int `yaml:"exit"`
ExitAny []int `yaml:"exit_any"`
OutputContains []string `yaml:"output_contains"`
OutputExcludes []string `yaml:"output_excludes"`
StdoutContains []string `yaml:"stdout_contains"`
StdoutIsJSON bool `yaml:"stdout_is_json"`
LockfileExists bool `yaml:"lockfile_exists"`
// LockfileExcludes asserts the generated lockfile does NOT contain each
// substring — e.g. `$/` self refs, which are inherently pinned and must
// never be recorded.
LockfileExcludes []string `yaml:"lockfile_excludes,omitempty"`
// FilesContain / FilesExclude assert substrings in repo-relative files
// after the run, used to verify `./`→`$/` rewrites in workflows and
// in-repo composite action.yml files.
FilesContain map[string][]string `yaml:"files_contain,omitempty"`
FilesExclude map[string][]string `yaml:"files_exclude,omitempty"`
Custom string `yaml:"custom"`
JQ []JQCheck `yaml:"jq,omitempty"`
GoldenJSON map[string]interface{} `yaml:"golden_json,omitempty"`
}
Expect declares assertions on the scenario outcome.
type Fixtures ¶
type Fixtures struct {
Workflows map[string]WorkflowFixture `yaml:"workflows"`
Lockfile string `yaml:"lockfile"`
LockfileTemplate string `yaml:"lockfile_template"`
// Files lays down arbitrary repo-relative files before the run, e.g.
// in-repo composite action.yml definitions that the default-on migration
// should also rewrite. Paths are relative to the repo root, not the
// workflows dir.
Files map[string]string `yaml:"files"`
}
Fixtures describes the file-system setup for a scenario.
type JQCheck ¶
type JQCheck struct {
Expr string `yaml:"expr"`
Equals string `yaml:"equals,omitempty"`
Contains string `yaml:"contains,omitempty"`
NotEquals string `yaml:"not_equals,omitempty"`
Matches string `yaml:"matches,omitempty"`
GreaterThan *int `yaml:"greater_than,omitempty"`
}
JQCheck is a single jq-based assertion on JSON output.
type Scenario ¶
type Scenario struct {
Name string `yaml:"name"`
Category string `yaml:"category"`
Description string `yaml:"description"`
NeedsToken bool `yaml:"needs_token"`
NeedsStub bool `yaml:"needs_stub"`
Skip string `yaml:"skip,omitempty"`
Tags []string `yaml:"tags"`
Flags []string `yaml:"flags"`
LiveRepo string `yaml:"live_repo"`
// Env sets or unsets process environment variables for the run. A nil
// value unsets the variable (YAML null), letting scenarios strip ambient
// auth or redirect GH_HOST to prove offline behavior.
Env map[string]*string `yaml:"env,omitempty"`
Fixtures Fixtures `yaml:"fixtures"`
Expect Expect `yaml:"expect"`
}
Scenario describes a single test scenario.
type WorkflowFixture ¶
type WorkflowFixture struct {
Name string `yaml:"name"`
Actions []string `yaml:"actions"`
Raw string `yaml:"raw"`
}
WorkflowFixture is either a structured action list or raw YAML.
Click to show internal directories.
Click to hide internal directories.