peg

package
v0.0.0-...-c5da712 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromData

func FromData(data []byte) types.MachineOption

FromFile populates a machineconfig from a peg config file.

func FromFile

func FromFile(f string) types.MachineOption

FromFile populates a machineconfig from a peg config file.

func Generate

func Generate(c *Config) error

Generates test suites from a peg file.

func Run

func Run(f string, opts ...Option) error

Run runs peg files.

Types

type AssertionBlock

type AssertionBlock struct {
	Describe string      `yaml:"describe,omitempty"`
	Command  string      `yaml:"command,omitempty"`
	Expect   ExpectBlock `yaml:"expect,omitempty"`
	PreOps   []OpBlock   `yaml:"preOps,omitempty"`
	PostOps  []OpBlock   `yaml:"postOps,omitempty"`
	OnHost   bool        `yaml:"onHost,omitempty"`
}

func (AssertionBlock) Show

func (a AssertionBlock) Show(logger logging.StandardLogger)

type Config

type Config struct {
	Machine *types.MachineConfig `yaml:"machine,omitempty"`
	Clean   bool

	Tests []Test `yaml:"specs,omitempty"`
}

type ExpectBlock

type ExpectBlock struct {
	ContainSubstring string        `yaml:"containString,omitempty"`
	Equal            string        `yaml:"equal,omitempty"`
	Or               []ExpectBlock `yaml:"or,omitempty"`
	And              []ExpectBlock `yaml:"and,omitempty"`
	ToFail           bool          `yaml:"toFail,omitempty"`
	Not              bool          `yaml:"not,omitempty"`
}

func (ExpectBlock) Show

func (exp ExpectBlock) Show(logger logging.StandardLogger)

type Failer

type Failer struct {
}

func NewFailer

func NewFailer() *Failer

Failer returns a simple fails that exists on failure.

func (Failer) Fail

func (f Failer) Fail()

type OpBlock

type OpBlock struct {
	EventuallyConnect int               `yaml:"eventuallyConnects,omitempty"`
	SendFile          map[string]string `yaml:"sendFile,omitempty"`
	ReceiveFile       map[string]string `yaml:"receiveFile,omitempty"`
}

func (OpBlock) Show

func (op OpBlock) Show(logger logging.StandardLogger)

type Option

type Option func(*Options) error
var AlwaysEmitGinkgoWriter Option = func(o *Options) error {
	o.AlwaysEmitGinkgoWriter = true
	return nil
}
var DryRun Option = func(o *Options) error {
	o.DryRun = true
	return nil
}
var EmitSpecProgress Option = func(o *Options) error {
	o.EmitSpecProgress = true
	return nil
}
var FailFast Option = func(o *Options) error {
	o.FailFast = true
	return nil
}
var NoColor Option = func(o *Options) error {
	o.NoColor = true
	return nil
}
var Succint Option = func(o *Options) error {
	o.Succint = true
	return nil
}
var Verbose Option = func(o *Options) error {
	o.Verbose = true
	return nil
}
var VeryVerbose Option = func(o *Options) error {
	o.VeryVerbose = true
	return nil
}

func WithFlakeAttempts

func WithFlakeAttempts(w int) Option

func WithJSONReport

func WithJSONReport(d string) Option

func WithJUnitReport

func WithJUnitReport(d string) Option

func WithLabelFilter

func WithLabelFilter(d string) Option

func WithMachineOptions

func WithMachineOptions(d ...types.MachineOption) Option

func WithSlowSpecThreshold

func WithSlowSpecThreshold(s string) Option

func WithTimeout

func WithTimeout(s string) Option

func WithWorkers

func WithWorkers(w int) Option

type Options

type Options struct {
	Workers                                                                                  int
	FailFast                                                                                 bool
	EmitSpecProgress, DryRun, Verbose, VeryVerbose, AlwaysEmitGinkgoWriter, Succint, NoColor bool
	LabelFilter                                                                              string
	FlakeAttempts                                                                            int
	Timeout, SlowSpecThreshold                                                               time.Duration
	JUnitReport, JSONReport                                                                  string

	MachineOptions []types.MachineOption
}

type Syncfailer

type Syncfailer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSyncedFailer

func NewSyncedFailer() *Syncfailer

SyncedFailer returns a thread-safe failer that collects a failure and makes it accessible for later inspection.

func (*Syncfailer) Fail

func (f *Syncfailer) Fail()

func (*Syncfailer) Failed

func (f *Syncfailer) Failed() bool

type Test

type Test struct {
	Label    string `yaml:"label,omitempty"`
	Describe string `yaml:"describe,omitempty"`

	Assertion map[string][]AssertionBlock `yaml:"assertions,omitempty"`
}

Jump to

Keyboard shortcuts

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