Documentation ¶
Index ¶
- func AllTestsInDirForComparator(comparator CRDComparator, directory string) ([]*simpleComparatorTest, error)
- func AllTestsInDirForComparators(comparators []CRDComparator, directory string) ([]*simpleComparatorTest, error)
- func AllTestsInDirForRegistry(registry CRDComparatorRegistry, directory string) ([]*simpleComparatorTest, error)
- func GetVersionByName(crd *apiextensionsv1.CustomResourceDefinition, versionName string) *apiextensionsv1.CustomResourceDefinitionVersion
- func RunAllTestsInDirForComparator(t *testing.T, comparator CRDComparator, directory string)
- func RunAllTestsInDirForComparators(t *testing.T, comparators []CRDComparator, directory string)
- func RunAllTestsInDirForRegistry(t *testing.T, registry CRDComparatorRegistry, directory string)
- func SchemaHas(s *apiextensionsv1.JSONSchemaProps, fldPath, simpleLocation *field.Path, ...) bool
- type CRDComparator
- func ConditionsMustHaveProperSSATags() CRDComparator
- func ListsMustHaveSSATags() CRDComparator
- func MustHaveStatus() CRDComparator
- func MustNotExceedCostBudget() CRDComparator
- func NoBools() CRDComparator
- func NoEnumRemoval() CRDComparator
- func NoFieldRemoval() CRDComparator
- func NoFloats() CRDComparator
- func NoMaps() CRDComparator
- func NoNewRequiredFields() CRDComparator
- func NoUints() CRDComparator
- type CRDComparatorRegistry
- type ComparatorTest
- type ComparisonResults
- type ComparisonResultsList
- type SchemaWalkerFunc
- type SingleCRDValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllTestsInDirForComparator ¶
func AllTestsInDirForComparator(comparator CRDComparator, directory string) ([]*simpleComparatorTest, error)
func AllTestsInDirForComparators ¶
func AllTestsInDirForComparators(comparators []CRDComparator, directory string) ([]*simpleComparatorTest, error)
func AllTestsInDirForRegistry ¶
func AllTestsInDirForRegistry(registry CRDComparatorRegistry, directory string) ([]*simpleComparatorTest, error)
func GetVersionByName ¶
func GetVersionByName(crd *apiextensionsv1.CustomResourceDefinition, versionName string) *apiextensionsv1.CustomResourceDefinitionVersion
GetVersionByName can be nil if the version doesn't exist
func RunAllTestsInDirForComparator ¶
func RunAllTestsInDirForComparator(t *testing.T, comparator CRDComparator, directory string)
func RunAllTestsInDirForComparators ¶
func RunAllTestsInDirForComparators(t *testing.T, comparators []CRDComparator, directory string)
func RunAllTestsInDirForRegistry ¶
func RunAllTestsInDirForRegistry(t *testing.T, registry CRDComparatorRegistry, directory string)
func SchemaHas ¶
func SchemaHas(s *apiextensionsv1.JSONSchemaProps, fldPath, simpleLocation *field.Path, ancestry []*apiextensionsv1.JSONSchemaProps, pred SchemaWalkerFunc) bool
SchemaHas recursively traverses the Schema and calls the `pred` predicate to see if the schema contains specific values.
The predicate MUST NOT keep a copy of the json schema NOR modify the schema.
Types ¶
type CRDComparator ¶
type CRDComparator interface { Name() string WhyItMatters() string Compare(existingCRD, newCRD *apiextensionsv1.CustomResourceDefinition) (ComparisonResults, error) }
func ConditionsMustHaveProperSSATags ¶
func ConditionsMustHaveProperSSATags() CRDComparator
func ListsMustHaveSSATags ¶
func ListsMustHaveSSATags() CRDComparator
func MustHaveStatus ¶
func MustHaveStatus() CRDComparator
func MustNotExceedCostBudget ¶
func MustNotExceedCostBudget() CRDComparator
func NoBools ¶
func NoBools() CRDComparator
func NoEnumRemoval ¶
func NoEnumRemoval() CRDComparator
func NoFieldRemoval ¶
func NoFieldRemoval() CRDComparator
func NoFloats ¶
func NoFloats() CRDComparator
func NoMaps ¶
func NoMaps() CRDComparator
func NoNewRequiredFields ¶
func NoNewRequiredFields() CRDComparator
func NoUints ¶
func NoUints() CRDComparator
type CRDComparatorRegistry ¶
type CRDComparatorRegistry interface { AddComparator(comparator CRDComparator) error GetComparator(name string) (CRDComparator, error) KnownComparators() []string AllComparators() []CRDComparator Compare(existingCRD, newCRD *apiextensionsv1.CustomResourceDefinition, names ...string) ([]ComparisonResults, []error) }
func NewRegistry ¶
func NewRegistry() CRDComparatorRegistry
type ComparatorTest ¶
type ComparatorTest struct { Name string ExistingCRD *apiextensionsv1.CustomResourceDefinition NewCRD *apiextensionsv1.CustomResourceDefinition ExpectedResults []ComparisonResults ExpectedErrors []string }
ComparatorTest represents the directory style test we have.
func AllTestsInDir ¶
func AllTestsInDir(directory string) ([]ComparatorTest, error)
func TestInDir ¶
func TestInDir(testName, directory string) (ComparatorTest, error)
func (*ComparatorTest) Test ¶
func (tc *ComparatorTest) Test(t *testing.T, actualResults []ComparisonResults, actualErrors []error)
type ComparisonResults ¶
type ComparisonResults struct { Name string `yaml:"name"` WhyItMatters string `yaml:"whyItMatters"` Errors []string `yaml:"errors"` Warnings []string `yaml:"warnings"` Infos []string `yaml:"infos"` }
func RatchetCompare ¶
func RatchetCompare(validator SingleCRDValidator, existingCRD, newCRD *apiextensionsv1.CustomResourceDefinition) (ComparisonResults, error)
type ComparisonResultsList ¶
type ComparisonResultsList struct {
Items []ComparisonResults `yaml:"items"`
}
type SchemaWalkerFunc ¶
type SchemaWalkerFunc func(s *apiextensionsv1.JSONSchemaProps, fldPath, simpleLocation *field.Path, ancestry []*apiextensionsv1.JSONSchemaProps) bool
ancestry is an order list of ancestors of s, where index 0 is the root and index len-1 is the direct parent
type SingleCRDValidator ¶
type SingleCRDValidator interface {
Validate(crd *apiextensionsv1.CustomResourceDefinition) (ComparisonResults, error)
}
Source Files ¶
- comp_conditions_must_have_proper_ssa_tags.go
- comp_lists_must_have_ssa_tags.go
- comp_must_have_status.go
- comp_must_not_exceed_cost_budget.go
- comp_no_bools.go
- comp_no_enum_removal.go
- comp_no_field_removal.go
- comp_no_floats.go
- comp_no_maps.go
- comp_no_new_required_fields.go
- comp_no_uints.go
- helpers.go
- interfaces.go
- racheting_validator.go
- registry.go
- simple_tester.go
Click to show internal directories.
Click to hide internal directories.