type Feature … type Environment … type NodeFeature … type Valid … // Add registers a new valid item name. The expected usage is // // var SomeFeature = framework.ValidFeatures.Add("Some") // // during the init phase of an E2E suite. Individual tests should not register // their own, to avoid uncontrolled proliferation of new items. E2E suites can, // but don't have to, enforce that by freezing the set of valid names. func (v *Valid[T]) Add(item T) T { … } func (v *Valid[T]) Freeze() { … } var ValidFeatures … var ValidEnvironments … var ValidNodeFeatures … var errInterface … // IgnoreNotFound can be used to wrap an arbitrary function in a call to // [ginkgo.DeferCleanup]. When the wrapped function returns an error that // `apierrors.IsNotFound` considers as "not found", the error is ignored // instead of failing the test during cleanup. This is useful for cleanup code // that just needs to ensure that some object does not exist anymore. func IgnoreNotFound(in any) any { … } // AnnotatedLocation can be used to provide more informative source code // locations by passing the result as additional parameter to a // BeforeEach/AfterEach/DeferCleanup/It/etc. func AnnotatedLocation(annotation string) types.CodeLocation { … } // AnnotatedLocationWithOffset skips additional call stack levels. With 0 as offset // it is identical to [AnnotatedLocation]. func AnnotatedLocationWithOffset(annotation string, offset int) types.CodeLocation { … } // SIGDescribe returns a wrapper function for ginkgo.Describe which injects // the SIG name as annotation. The parameter should be lowercase with // no spaces and no sig- or SIG- prefix. func SIGDescribe(sig string) func(...interface{ … } var sigRE … // ConformanceIt is wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier. func ConformanceIt(args ...interface{ … } // It is a wrapper around [ginkgo.It] which supports framework With* labels as // optional arguments in addition to those already supported by ginkgo itself, // like [ginkgo.Label] and [ginkgo.Offset]. // // Text and arguments may be mixed. The final text is a concatenation // of the text arguments and special tags from the With functions. func It(args ...interface{ … } // It is a shorthand for the corresponding package function. func (f *Framework) It(args ...interface{ … } // Describe is a wrapper around [ginkgo.Describe] which supports framework // With* labels as optional arguments in addition to those already supported by // ginkgo itself, like [ginkgo.Label] and [ginkgo.Offset]. // // Text and arguments may be mixed. The final text is a concatenation // of the text arguments and special tags from the With functions. func Describe(args ...interface{ … } // Describe is a shorthand for the corresponding package function. func (f *Framework) Describe(args ...interface{ … } // Context is a wrapper around [ginkgo.Context] which supports framework With* // labels as optional arguments in addition to those already supported by // ginkgo itself, like [ginkgo.Label] and [ginkgo.Offset]. // // Text and arguments may be mixed. The final text is a concatenation // of the text arguments and special tags from the With functions. func Context(args ...interface{ … } // Context is a shorthand for the corresponding package function. func (f *Framework) Context(args ...interface{ … } // registerInSuite is the common implementation of all wrapper functions. It // expects to be called through one intermediate wrapper. func registerInSuite(ginkgoCall func(string, ...interface{ … } var tagRe … var deprecatedTags … var deprecatedTagPrefixes … var deprecatedStability … // validateSpecs checks that the test specs were registered as intended. func validateSpecs(specs types.SpecReports) { … } type call … // validateText checks for some known tags that should not be added through the // plain text strings anymore. Eventually, all such tags should get replaced // with the new APIs. func validateText(location types.CodeLocation, text string, labels []string) { … } func recordTextBug(location types.CodeLocation, message string) { … } // WithEnvironment specifies that a certain test or group of tests only works // with a feature available. The return value must be passed as additional // argument to [framework.It], [framework.Describe], [framework.Context]. // // The feature must be listed in ValidFeatures. func WithFeature(name Feature) interface{ … } // WithFeature is a shorthand for the corresponding package function. func (f *Framework) WithFeature(name Feature) interface{ … } func withFeature(name Feature) interface{ … } // WithFeatureGate specifies that a certain test or group of tests depends on a // feature gate being enabled. The return value must be passed as additional // argument to [framework.It], [framework.Describe], [framework.Context]. // // The feature gate must be listed in // [k8s.io/apiserver/pkg/util/feature.DefaultMutableFeatureGate]. Once a // feature gate gets removed from there, the WithFeatureGate calls using it // also need to be removed. // // [Alpha] resp. [Beta] get added to the test name automatically depending // on the current stability level of the feature. Feature:Alpha resp. // Feature:Beta get added to the Ginkgo labels because this is a special // requirement for how the cluster needs to be configured. // // If the test can run in any cluster that has alpha resp. beta features and // API groups enabled, then annotating it with just WithFeatureGate is // sufficient. Otherwise, WithFeature has to be used to define the additional // requirements. func WithFeatureGate(featureGate featuregate.Feature) interface{ … } // WithFeatureGate is a shorthand for the corresponding package function. func (f *Framework) WithFeatureGate(featureGate featuregate.Feature) interface{ … } func withFeatureGate(featureGate featuregate.Feature) interface{ … } // WithEnvironment specifies that a certain test or group of tests only works // in a certain environment. The return value must be passed as additional // argument to [framework.It], [framework.Describe], [framework.Context]. // // The environment must be listed in ValidEnvironments. func WithEnvironment(name Environment) interface{ … } // WithEnvironment is a shorthand for the corresponding package function. func (f *Framework) WithEnvironment(name Environment) interface{ … } func withEnvironment(name Environment) interface{ … } // WithNodeFeature specifies that a certain test or group of tests only works // if the node supports a certain feature. The return value must be passed as // additional argument to [framework.It], [framework.Describe], // [framework.Context]. // // The environment must be listed in ValidNodeFeatures. func WithNodeFeature(name NodeFeature) interface{ … } // WithNodeFeature is a shorthand for the corresponding package function. func (f *Framework) WithNodeFeature(name NodeFeature) interface{ … } func withNodeFeature(name NodeFeature) interface{ … } // WithConformace specifies that a certain test or group of tests must pass in // all conformant Kubernetes clusters. The return value must be passed as // additional argument to [framework.It], [framework.Describe], // [framework.Context]. func WithConformance() interface{ … } // WithConformance is a shorthand for the corresponding package function. func (f *Framework) WithConformance() interface{ … } func withConformance() interface{ … } // WithNodeConformance specifies that a certain test or group of tests for node // functionality that does not depend on runtime or Kubernetes distro specific // behavior. The return value must be passed as additional argument to // [framework.It], [framework.Describe], [framework.Context]. func WithNodeConformance() interface{ … } // WithNodeConformance is a shorthand for the corresponding package function. func (f *Framework) WithNodeConformance() interface{ … } func withNodeConformance() interface{ … } // WithDisruptive specifies that a certain test or group of tests temporarily // affects the functionality of the Kubernetes cluster. The return value must // be passed as additional argument to [framework.It], [framework.Describe], // [framework.Context]. func WithDisruptive() interface{ … } // WithDisruptive is a shorthand for the corresponding package function. func (f *Framework) WithDisruptive() interface{ … } func withDisruptive() interface{ … } // WithSerial specifies that a certain test or group of tests must not run in // parallel with other tests. The return value must be passed as additional // argument to [framework.It], [framework.Describe], [framework.Context]. // // Starting with ginkgo v2, serial and parallel tests can be executed in the // same invocation. Ginkgo itself will ensure that the serial tests run // sequentially. func WithSerial() interface{ … } // WithSerial is a shorthand for the corresponding package function. func (f *Framework) WithSerial() interface{ … } func withSerial() interface{ … } // WithSlow specifies that a certain test or group of tests must not run in // parallel with other tests. The return value must be passed as additional // argument to [framework.It], [framework.Describe], [framework.Context]. func WithSlow() interface{ … } // WithSlow is a shorthand for the corresponding package function. func (f *Framework) WithSlow() interface{ … } func withSlow() interface{ … } // WithLabel is a wrapper around [ginkgo.Label]. Besides adding an arbitrary // label to a test, it also injects the label in square brackets into the test // name. func WithLabel(label string) interface{ … } // WithLabel is a shorthand for the corresponding package function. func (f *Framework) WithLabel(label string) interface{ … } func withLabel(label string) interface{ … } // WithFlaky specifies that a certain test or group of tests are failing randomly. // These tests are usually filtered out and ran separately from other tests. func WithFlaky() interface{ … } // WithFlaky is a shorthand for the corresponding package function. func (f *Framework) WithFlaky() interface{ … } func withFlaky() interface{ … } type label … func newLabel(parts ...string) label { … } // TagsEqual can be used to check whether two tags are the same. // It's safe to compare e.g. the result of WithSlow() against the result // of WithSerial(), the result will be false. False is also returned // when a parameter is some completely different value. func TagsEqual(a, b interface{ … }