verify

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SkipReasonName            = "Test name did not match the provided pattern"
	SkipReasonResource        = "Resource matched a policy that was excluded from the bundle"
	SkipReasonPrincipal       = "Principal matched a policy that was excluded from the bundle"
	SkipReasonFilterSuite     = "Suite did not match the test filter"
	SkipReasonFilterTest      = "Test did not match the test filter"
	SkipReasonFilterPrincipal = "Principal did not match the test filter"
	SkipReasonFilterResource  = "Resource did not match the test filter"
	SkipReasonFilterAction    = "No actions matched the test filter"
)

Variables

This section is empty.

Functions

func IsFilterSkipReason added in v0.51.0

func IsFilterSkipReason(reason string) bool

func Verify

func Verify(ctx context.Context, fsys fs.FS, eng Checker, conf Config) (*policyv1.TestResults, error)

func VerifyStream added in v0.51.0

func VerifyStream(ctx context.Context, fsys fs.FS, eng Checker, conf Config) (int, <-chan *policyv1.TestResults_Suite, error)

VerifyStream runs test suites and streams results as each suite completes. It returns the number of test suites, a channel of results, and any setup error. Callers may cancel the context to stop workers early and avoid unnecessary work.

Types

type AuxData added in v0.31.0

type AuxData struct {
	LoadError error
	Fixtures  map[string]*enginev1.AuxData
	FilePath  string
}

type Checker added in v0.21.0

type Checker interface {
	Check(ctx context.Context, inputs []*enginev1.CheckInput, opts ...evaluator.CheckOpt) ([]*enginev1.CheckOutput, error)
}

type Config

type Config struct {
	ExcludedResourcePolicyFQNs  map[string]struct{}
	ExcludedPrincipalPolicyFQNs map[string]struct{}
	Filter                      *FilterConfig
	IncludedTestNamesRegexp     string
	Workers                     uint
	Trace                       bool
	SkipBatching                bool
}

type FilterConfig added in v0.51.0

type FilterConfig struct {
	Suite     []string
	Test      []string
	Principal []string
	Resource  []string
	Action    []string
}

func ParseFilterConfig added in v0.51.0

func ParseFilterConfig(filter string) (*FilterConfig, error)

ParseFilterConfig parses a filter string in the format: "test=glob1,glob2;principal=glob3;resource=glob4;action=glob5".

func (*FilterConfig) IsEmpty added in v0.51.0

func (fc *FilterConfig) IsEmpty() bool

func (*FilterConfig) Merge added in v0.51.0

func (fc *FilterConfig) Merge(other *FilterConfig) *FilterConfig

type FilterDimension added in v0.51.0

type FilterDimension string
const (
	FilterDimensionSuite     FilterDimension = "suite"
	FilterDimensionTest      FilterDimension = "test"
	FilterDimensionPrincipal FilterDimension = "principal"
	FilterDimensionResource  FilterDimension = "resource"
	FilterDimensionAction    FilterDimension = "action"
)

type Principals added in v0.31.0

type Principals struct {
	LoadError error
	Fixtures  map[string]*enginev1.Principal
	Groups    map[string][]string
	FilePath  string
}

type Resources added in v0.31.0

type Resources struct {
	LoadError error
	Fixtures  map[string]*enginev1.Resource
	Groups    map[string][]string
	FilePath  string
}

type TestFixture added in v0.31.0

type TestFixture struct {
	Principals *Principals
	Resources  *Resources
	AuxData    *AuxData
}

func LoadTestFixture added in v0.31.0

func LoadTestFixture(fsys fs.FS, path string, continueOnError bool) (tf *TestFixture, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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