test

package
v4.44.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigSpec

func ConfigSpec() docs.FieldSpec

ConfigSpec returns a configuration spec for a template.

Types

type BloblangCondition

type BloblangCondition struct {
	// contains filtered or unexported fields
}

BloblangCondition represents a test bloblang condition.

func (*BloblangCondition) Check

func (b *BloblangCondition) Check(fs fs.FS, dir string, p *message.Part) error

Check runs the bloblang condition check.

type Case

type Case struct {
	Name             string
	Environment      map[string]string
	TargetProcessors string
	TargetMapping    string
	Mocks            map[string]any
	InputBatches     [][]InputConfig
	OutputBatches    [][]OutputConditionsMap
	// contains filtered or unexported fields
}

Case contains a definition of a single Benthos config test case.

func CaseFromAny

func CaseFromAny(v any) (Case, error)

CaseFromAny attempts to return a Case from the untyped input parameter.

func CaseFromParsed

func CaseFromParsed(pConf *docs.ParsedConfig) (c Case, err error)

CaseFromParsed extracts a Case from a parsed config.

func FromAny

func FromAny(v any) ([]Case, error)

FromAny returns a Case slice from a yaml node or parsed config.

func FromParsed

func FromParsed(pConf *docs.ParsedConfig) ([]Case, error)

FromParsed extracts a Case slice from a parsed config.

func (*Case) Line

func (c *Case) Line() int

Line returns the case line.

type ContentEqualsCondition

type ContentEqualsCondition string

ContentEqualsCondition represents a test ContentEquals condition.

func (ContentEqualsCondition) Check

func (c ContentEqualsCondition) Check(fs fs.FS, dir string, p *message.Part) error

Check runs the ContentEquals condition check.

type ContentJSONContainsCondition

type ContentJSONContainsCondition string

ContentJSONContainsCondition represents a test ContentJSONContains condition.

func (ContentJSONContainsCondition) Check

func (c ContentJSONContainsCondition) Check(fs fs.FS, dir string, p *message.Part) error

Check runs the ContentJSONContains condition check.

type ContentJSONEqualsCondition

type ContentJSONEqualsCondition string

ContentJSONEqualsCondition represents a test ContentJSONEquals condition.

func (ContentJSONEqualsCondition) Check

func (c ContentJSONEqualsCondition) Check(fs fs.FS, dir string, p *message.Part) error

Check runs the ContentJSONEquals condition check.

type ContentMatchesCondition

type ContentMatchesCondition string

ContentMatchesCondition represents a test ContentMatches condition.

func (ContentMatchesCondition) Check

func (c ContentMatchesCondition) Check(fs fs.FS, dir string, p *message.Part) error

Check runs the ContentMatches condition check.

type FileEqualsCondition

type FileEqualsCondition string

FileEqualsCondition represents a test FileEquals condition.

func (FileEqualsCondition) Check

func (c FileEqualsCondition) Check(fs fs.FS, dir string, p *message.Part) error

Check runs the FileEquals condition check.

type FileJSONContainsCondition

type FileJSONContainsCondition string

FileJSONContainsCondition represents a test FileJSONContains condition.

func (FileJSONContainsCondition) Check

func (c FileJSONContainsCondition) Check(fs fs.FS, dir string, p *message.Part) error

Check runs the FileJSONContains condition check.

type FileJSONEqualsCondition

type FileJSONEqualsCondition string

FileJSONEqualsCondition represents a test FileJSONEquals condition.

func (FileJSONEqualsCondition) Check

func (c FileJSONEqualsCondition) Check(fs fs.FS, dir string, p *message.Part) error

Check runs the FileJSONEquals condition check.

type InputConfig

type InputConfig struct {
	Content  string
	Path     string
	Metadata map[string]any
}

InputConfig represents the test input config.

func InputFromParsed

func InputFromParsed(pConf *docs.ParsedConfig) (conf InputConfig, err error)

InputFromParsed creates an InputConfig from a parsed config.

func (InputConfig) ToMessage

func (i InputConfig) ToMessage(fs fs.FS, dir string) (*message.Part, error)

ToMessage creates a message from an InputConfig.

type MetadataEqualsCondition

type MetadataEqualsCondition map[string]any

MetadataEqualsCondition represents a test MetadataEquals condition.

func (MetadataEqualsCondition) Check

func (m MetadataEqualsCondition) Check(fs fs.FS, dir string, p *message.Part) error

Check runs the MetadataEquals condition check.

type OutputCondition

type OutputCondition interface {
	Check(fs fs.FS, dir string, part *message.Part) error
}

OutputCondition contains a test output condition.

type OutputConditionsMap

type OutputConditionsMap map[string]OutputCondition

OutputConditionsMap represents a collection of output conditions.

func OutputConditionsFromParsed

func OutputConditionsFromParsed(pConf *docs.ParsedConfig) (m OutputConditionsMap, err error)

OutputConditionsFromParsed extracts an OutputConditionsMap from a parsed config.

func (OutputConditionsMap) CheckAll

func (c OutputConditionsMap) CheckAll(fs fs.FS, dir string, part *message.Part) (errs []error)

CheckAll runs all output condition checks.

Jump to

Keyboard shortcuts

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