scenarios

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 4 Imported by: 0

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

func Load() (*Catalog, error)

Load reads the catalog from the canonical location relative to this package's source file. Suitable for use in tests.

func LoadFrom

func LoadFrom(path string) (*Catalog, error)

LoadFrom reads and parses a catalog from the given path.

func (*Catalog) ByCategory

func (c *Catalog) ByCategory(cat string) []Scenario

ByCategory returns scenarios matching the given category name.

func (*Catalog) ByTag

func (c *Catalog) ByTag(tag string) []Scenario

ByTag returns scenarios having the given tag.

func (*Catalog) Names

func (c *Catalog) Names() []string

Names returns all scenario names.

type Category

type Category struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
}

Category groups related scenarios.

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"`
	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"`
}

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"`

	Fixtures Fixtures `yaml:"fixtures"`
	Expect   Expect   `yaml:"expect"`
}

Scenario describes a single test scenario.

func (*Scenario) HasTag

func (s *Scenario) HasTag(tag string) bool

HasTag reports whether the scenario has the given tag.

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.

Jump to

Keyboard shortcuts

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