Versions in this module Expand all Collapse all v3 v3.9.9 Jun 3, 2022 Changes in this version + const Group + const Kind + var ErrAddInventory = errors.New("unable to add object to data.inventory") + var ErrAddingConstraint = errors.New("adding constraint") + var ErrAddingTemplate = errors.New("adding template") + var ErrConvertingTemplate = errors.New("unable to convert template") + var ErrCreatingClient = errors.New("creating client") + var ErrInvalidCase = errors.New("invalid Case") + var ErrInvalidFilter = errors.New("invalid test filter") + var ErrInvalidRegex = errors.New("message contains invalid regular expression") + var ErrInvalidSuite = errors.New("invalid Suite") + var ErrInvalidYAML = errors.New("invalid yaml") + var ErrMultipleObjects = errors.New("object file must contain exactly one object") + var ErrNoFileSystem = errors.New("no filesystem") + var ErrNoObjects = errors.New("missing objects") + var ErrNoTarget = errors.New("target not specified") + var ErrNotAConstraint = errors.New("not a Constraint") + var ErrNotADirectory = errors.New("not a directory") + var ErrNotATemplate = errors.New("not a ConstraintTemplate") + var ErrNumViolations = errors.New("unexpected number of violations") + var ErrUnsupportedExtension = errors.New("unsupported extension") + var ErrWritingString = errors.New("writing output") + func ReadK8sResources(r io.Reader) ([]*unstructured.Unstructured, error) + func ReadObject(f fs.FS, path string) (*unstructured.Unstructured, error) + func ReadTemplate(scheme *runtime.Scheme, f fs.FS, path string) (*templates.ConstraintTemplate, error) + func ToTemplate(scheme *runtime.Scheme, u *unstructured.Unstructured) (*templates.ConstraintTemplate, error) + type Assertion struct + Message *string + Violations *intstr.IntOrString + func (a *Assertion) Run(results []*types.Result) error + type Case struct + Assertions []Assertion + Inventory []string + Name string + Object string + Skip bool + type CaseResult struct + Error error + Name string + Runtime Duration + Skipped bool + func (r *CaseResult) IsFailure() bool + type Client interface + AddConstraint func(ctx context.Context, constraint *unstructured.Unstructured) (*types.Responses, error) + AddData func(ctx context.Context, data interface{}) (*types.Responses, error) + AddTemplate func(ctx context.Context, templ *templates.ConstraintTemplate) (*types.Responses, error) + RemoveData func(ctx context.Context, data interface{}) (*types.Responses, error) + Review func(ctx context.Context, obj interface{}, opts ...drivers.QueryOpt) (*types.Responses, error) + func NewOPAClient() (Client, error) + type Duration time.Duration + func (d Duration) String() string + type Filter interface + MatchesCase func(testName, caseName string) bool + MatchesTest func(Test) bool + func NewFilter(filter string) (Filter, error) + type Printer interface + Print func(w StringWriter, r []SuiteResult, verbose bool) error + type PrinterGo struct + func (p PrinterGo) Print(w StringWriter, r []SuiteResult, verbose bool) error + func (p PrinterGo) PrintCase(w StringWriter, r *CaseResult, verbose bool) error + func (p PrinterGo) PrintSuite(w StringWriter, r *SuiteResult, verbose bool) error + func (p PrinterGo) PrintTest(w StringWriter, r *TestResult, verbose bool) error + type Runner struct + func NewRunner(filesystem fs.FS, newClient func() (Client, error)) (*Runner, error) + func (r *Runner) Run(ctx context.Context, filter Filter, s *Suite) SuiteResult + type StringWriter interface + WriteString func(s string) (int, error) + type Suite struct + Path string + Skip bool + Tests []Test + func ReadSuites(f fs.FS, target string, recursive bool) ([]*Suite, error) + type SuiteResult struct + Error error + Path string + Runtime Duration + Skipped bool + TestResults []TestResult + func (r *SuiteResult) IsFailure() bool + type Test struct + Cases []*Case + Constraint string + Name string + Skip bool + Template string + type TestResult struct + CaseResults []CaseResult + Error error + Name string + Runtime Duration + Skipped bool + func (r *TestResult) IsFailure() bool