check

package
v0.0.0-...-a129325 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package check provides implementation of check functions or jobs that are used in system validation.

Base

The base job implements all components of the amboy.Job interface and all common components of the greenbay.Check interface, including error handling and job processing. All checks should, typically, compose a pointer to Base.

For an example of a check that uses Base, see the test job in the "mock_check_for_test.go" file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	WasSuccessful bool                `bson:"passed" json:"passed" yaml:"passed"`
	Message       string              `bson:"message" json:"message" yaml:"message"`
	TestSuites    []string            `bson:"suites" json:"suites" yaml:"suites"`
	Timing        greenbay.TimingInfo `bson:"timing" json:"timing" yaml:"timing"`
	*job.Base     `bson:"metadata" json:"metadata" yaml:"metadata"`
	// contains filtered or unexported fields
}

Base is a type that all new checks should compose, and provides an implementation of most common amboy.Job and greenbay.Check methods.

func NewBase

func NewBase(checkName string, version int) *Base

NewBase exists for use in the constructors of individual checks.

func (*Base) Name

func (b *Base) Name() string

Name returns the name of the *check* rather than the name of the task.

func (*Base) Output

func (b *Base) Output() greenbay.CheckOutput

Output returns a consistent output format for greenbay.Checks, which may be useful for generating common output formats.

func (*Base) SetSuites

func (b *Base) SetSuites(suites []string)

SetSuites allows callers, typically the configuration parser, to set the suites.

func (*Base) Suites

func (b *Base) Suites() []string

Suites reports which suites the current check belongs to.

type GroupRequirements

type GroupRequirements struct {
	Any  bool
	One  bool
	None bool
	All  bool
	Name string
}

GroupRequirements provides a way to express expected outcomes for checks that include multiple constituent checks. (e.g. a list of files that must exist or a list of commands to run.)

func (GroupRequirements) GetResults

func (gr GroupRequirements) GetResults(passes, failures int) (bool, error)

GetResults takes numbers of passed and failed tasks and reports if the check should succeed.

func (GroupRequirements) Validate

func (gr GroupRequirements) Validate() error

Validate checks the GroupRequirements structure and ensures that the specified results are valid and that there are no contradictory or impossible expectations.

Jump to

Keyboard shortcuts

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