fragment

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseTestDoc

func ParseTestDoc(data []byte) ([]*types.TestCase, error)

ParseTestDoc deserializes a YAML test document and stamps every TestCase with Type="unit". Returns an empty slice (not nil) when tests is empty.

Types

type AugmentedFragment

type AugmentedFragment struct {
	Fragment *Fragment `yaml:"fragment,omitempty"`
	Metadata *Metadata `yaml:"metadata,omitempty"`
}

type Fragment

type Fragment struct {
	// Namespace is the fragment's identity and the prefix applied to all receiver
	// and route receiver names during assembly. Auto-set to the directory basename
	// if not declared in YAML.
	Namespace    string               `yaml:"namespace,omitempty"`
	Group        *FragmentGroup       `yaml:"group,omitempty"`
	Routes       []*config.Route      `yaml:"routes,omitempty"`
	Receivers    []*types.Receiver    `yaml:"receivers,omitempty"`
	InhibitRules []config.InhibitRule `yaml:"inhibit_rules,omitempty"`
	// Deprecated. Remove before v1.0 release.
	MuteTimeIntervals []config.MuteTimeInterval `yaml:"mute_time_intervals,omitempty" json:"mute_time_intervals,omitempty"`
	TimeIntervals     []config.TimeInterval     `yaml:"time_intervals,omitempty" json:"time_intervals,omitempty"`
	// Tests are discovered from sibling *-tests.yml files and tests/ subdirectory
	// via dedicated parsing (see testDoc). Never serialized as part of the
	// Fragment YAML — yaml:"-" suppresses both encode and decode.
	Tests []*types.TestCase `yaml:"-"`
	// contains filtered or unexported fields
}

func New

func New(dir string) *Fragment

func (*Fragment) Read

func (f *Fragment) Read() (*Metadata, error)

type FragmentGroup

type FragmentGroup struct {
	Match    map[string]string `yaml:"match"`
	Receiver string            `yaml:"receiver"`
}

type LoadResult

type LoadResult struct {
	Fragments []AugmentedFragment `yaml:"fragments,omitempty"`
}

func Load

func Load(dir string) (*LoadResult, error)

type Metadata

type Metadata struct {
	Dir   string   `yaml:"dir,omitempty"`
	Files []string `yaml:"files,omitempty"`
}

type TestDoc

type TestDoc struct {
	Tests []*types.TestCase `yaml:"tests"`
}

Jump to

Keyboard shortcuts

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