Documentation
¶
Overview ¶
The assertion package provides common functionality used to define assertions against a set of one or more Kubernetes resources.
Index ¶
- func AsFeature(assert Assertion) features.Feature
- type Assertion
- type Option
- func WithBuilder(builder *features.FeatureBuilder) Option
- func WithInterval(interval time.Duration) Option
- func WithRequireT(requireT require.TestingT) Option
- func WithResourceFields(fields map[string]string) Option
- func WithResourceLabels(labels map[string]string) Option
- func WithResourceName(name string) Option
- func WithResourceNamespace(namespaceName string) Option
- func WithResourceNamespaceFromTestEnv() Option
- func WithSetup(steps ...e2etypes.StepFunc) Option
- func WithTeardown(steps ...e2etypes.StepFunc) Option
- func WithTimeout(timeout time.Duration) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Assertion ¶
type Assertion interface {
// GetLabels returns the labels (i.e. metadata.labels) used to select resources for the assertion.
GetLabels() map[string]string
// GetFields returns the fields used to select resources for the assertion.
GetFields() map[string]string
// GetListOptions returns the ListOptions used to when listing resources from the API server.
ListOptions(cfg *envconf.Config) metav1.ListOptions
// GetInterval returns the interval used when polling for the assertion to be true.
GetInterval() time.Duration
// GetTimeout returns the timeout used when polling for the assertion to be true.
GetTimeout() time.Duration
// GetBuilder returns the features.FeatureBuilder used to build the e2e-framework Feature.
GetBuilder() *features.FeatureBuilder
// SetBuilder sets the features.FeatureBuilder used to build the e2e-framework Feature.
SetBuilder(builder *features.FeatureBuilder)
// GetRequireT returns the require.TestingT used to report test failures. This is largely intended for testing
// as it enables detection of failing require/assert statements.
GetRequireT() require.TestingT
// contains filtered or unexported methods
}
Assertion is an interface for a generic assertion (har) about the state of one or more resources in a Kubernetes cluster. It is embedded into other assertion types to provide common functionality.
func Clone ¶
Clone clones an assertion. This is done this way instead of providing an exported Clone method in order to avoid having the Clone method exported on all assertion types.
func NewAssertion ¶
NewAssertion creates a new Assertion with the provided options.
type Option ¶
type Option func(Assertion)
Option is a function that configures one or more facets of an Assertion.
func WithBuilder ¶
func WithBuilder(builder *features.FeatureBuilder) Option
WithBuilder sets the features.FeatureBuilder used to build the e2e-framework Feature.
func WithInterval ¶
WithInterval sets the interval used when polling for the assertion to be true.
func WithRequireT ¶
WithRequireT sets the require.TestingT used to report test failures.
func WithResourceFields ¶
WithResourceFields sets the fields to be used when selecting resources for the assertion.
func WithResourceLabels ¶
WithResourceLabels sets the labels to be used when selecting resources for the assertion.
func WithResourceName ¶
WithResourceName sets the name (i.e. metadata.name) to be used when selecting resources for the assertion.
func WithResourceNamespace ¶
WithResourceNamespace sets the namespace to be used when selecting resources for the assertion.
func WithResourceNamespaceFromTestEnv ¶
func WithResourceNamespaceFromTestEnv() Option
WithResourceNamespaceFromTestEnv sets the namespace to be used when selecting resources for the assertion to the namespace set in the test environment.
func WithTeardown ¶
WithTeardown adds teardown steps to the assertion.
func WithTimeout ¶
WithTimeout sets the timeout used when polling for the assertion to be true.