kubernetes/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/compilation_test.go

const costLimit

type validationMatcher

type allMatcher

func matchesAll(matchers ...validationMatcher) validationMatcher {}

func (m allMatcher) matches(cr CompilationResult) bool {}

func (m allMatcher) String() string {}

type fnMatcher

func (m fnMatcher) matches(cr CompilationResult) bool {}

func (m fnMatcher) String() string {}

type errorMatcher

func invalidError(contains string) validationMatcher {}

func (v errorMatcher) matches(cr CompilationResult) bool {}

func (v errorMatcher) String() string {}

type messageExpressionErrorMatcher

func messageExpressionError(contains string) validationMatcher {}

func (m messageExpressionErrorMatcher) matches(cr CompilationResult) bool {}

func (m messageExpressionErrorMatcher) String() string {}

type noErrorMatcher

func noError() validationMatcher {}

func (noErrorMatcher) matches(cr CompilationResult) bool {}

func (noErrorMatcher) String() string {}

type transitionRuleMatcher

func transitionRule(t bool) validationMatcher {}

func (v transitionRuleMatcher) matches(cr CompilationResult) bool {}

func (v transitionRuleMatcher) String() string {}

func TestCelCompilation(t *testing.T) {}

// take a single rule type in (string/number/map/etc.) and return appropriate values for
// Type, Format, and XIntOrString
func parseRuleType(ruleType string) (string, string, bool) {}

func genArrayWithRule(arrayType, rule string) func(maxItems *int64) *schema.Structural {}

func genArrayOfArraysWithRule(arrayType, rule string) func(maxItems *int64) *schema.Structural {}

func genObjectArrayWithRule(rule string) func(maxItems *int64) *schema.Structural {}

func getMapArrayWithRule(mapType, rule string) func(maxItems *int64) *schema.Structural {}

func genMapWithRule(mapType, rule string) func(maxProperties *int64) *schema.Structural {}

func genStringWithRule(rule string) func(maxLength *int64) *schema.Structural {}

// genEnumWithRuleAndValues creates a function that accepts an optional maxLength
// with given validation rule and a set of enum values, following the convention of existing tests.
// The test has two checks, first with maxLength unset to check if maxLength can be concluded from enums,
// second with maxLength set to ensure it takes precedence.
func genEnumWithRuleAndValues(rule string, values ...string) func(maxLength *int64) *schema.Structural {}

func genBytesWithRule(rule string) func(maxLength *int64) *schema.Structural {}

func genNestedSpecWithRule(rule string) func(maxLength *int64) *schema.Structural {}

func genAllMaxNestedSpecWithRootRule(rule string) func(maxLength *int64) *schema.Structural {}

func genOneMaxNestedSpecWithRootRule(rule string) func(maxLength *int64) *schema.Structural {}

func genObjectForMap() *schema.Structural {}

func genArrayForMap() *schema.Structural {}

func genMapForMap() *schema.Structural {}

func genMapWithCustomItemRule(item *schema.Structural, rule string) func(maxProperties *int64) *schema.Structural {}

// schemaChecker checks the cost of the validation rule declared in the provided schema (it requires there be exactly one rule)
// and checks that the resulting equals the expectedCost if expectedCost is non-zero, and that the resulting cost is >= expectedCostExceedsLimit
// if expectedCostExceedsLimit is non-zero. Typically, only expectedCost or expectedCostExceedsLimit is non-zero, not both.
func schemaChecker(schema *schema.Structural, expectedCost uint64, expectedCostExceedsLimit uint64, t *testing.T) func(t *testing.T) {}

func TestCostEstimation(t *testing.T) {}

func BenchmarkCompile(b *testing.B) {}

type fakeLib

var testLibraryDecls

func (*fakeLib) CompileOptions() []celgo.EnvOption {}

func (*fakeLib) ProgramOptions() []celgo.ProgramOption {}

func fakeFunction(arg1 ref.Val) ref.Val {}