Documentation
¶
Index ¶
- func BeControlledBy(expectedOwner any) types.GomegaMatcher
- func BeOwnedBy(expectedOwner any) types.GomegaMatcher
- func BeSematicEqual(expected interface{}) types.GomegaMatcher
- func HaveBackendRefs(backends ...gwapiv1.HTTPBackendRef) types.GomegaMatcher
- func HaveCondition(conditionType string, expectedStatus string) types.GomegaMatcher
- func HaveContainerImage(expectedImage string) types.GomegaMatcher
- func HaveGatewayRefs(expectedGateways ...gwapiv1.ParentReference) types.GomegaMatcher
- func NewTestLogger(t testingT) logr.Logger
- func ProjectRoot() string
- func SetupEnvTest(crdDirectoryPaths []string) *envtest.Environment
- type AddToSchemeFunc
- type BeSematicEqualMatcher
- type Cleaner
- type Client
- type Config
- type Option
- type SetupFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeControlledBy ¶ added in v0.16.0
func BeControlledBy(expectedOwner any) types.GomegaMatcher
BeControlledBy returns a matcher that checks if a Kubernetes object is owned AND controlled by the specified owner
func BeOwnedBy ¶ added in v0.16.0
func BeOwnedBy(expectedOwner any) types.GomegaMatcher
BeOwnedBy returns a matcher that checks if a Kubernetes object is owned by the specified owner
func BeSematicEqual ¶ added in v0.1.0
func BeSematicEqual(expected interface{}) types.GomegaMatcher
func HaveBackendRefs ¶ added in v0.16.0
func HaveBackendRefs(backends ...gwapiv1.HTTPBackendRef) types.GomegaMatcher
HaveBackendRefs returns a matcher that checks if an HTTPRoute has the specified backend refs.
func HaveCondition ¶ added in v0.16.0
func HaveCondition(conditionType string, expectedStatus string) types.GomegaMatcher
HaveCondition returns a matcher that checks if a Status has a condition with the specified type and status
func HaveContainerImage ¶ added in v0.16.0
func HaveContainerImage(expectedImage string) types.GomegaMatcher
HaveContainerImage returns a matcher that checks if a Deployment has a container with the specified image
func HaveGatewayRefs ¶ added in v0.16.0
func HaveGatewayRefs(expectedGateways ...gwapiv1.ParentReference) types.GomegaMatcher
HaveGatewayRefs returns a matcher that checks if an HTTPRoute has the specified gateway parent refs
func NewTestLogger ¶ added in v0.16.0
NewTestLogger returns a logr.Logger that prints to the given testing.T. This is useful for logging in tests, as the output will be buffered and printed only if the test fails.
func ProjectRoot ¶ added in v0.16.0
func ProjectRoot() string
ProjectRoot returns the root directory of the project by searching for the go.mod file up from where it is called.
func SetupEnvTest ¶
func SetupEnvTest(crdDirectoryPaths []string) *envtest.Environment
Types ¶
type AddToSchemeFunc ¶ added in v0.16.0
type BeSematicEqualMatcher ¶ added in v0.1.0
type BeSematicEqualMatcher struct {
Expected interface{}
}
func (*BeSematicEqualMatcher) FailureMessage ¶ added in v0.1.0
func (matcher *BeSematicEqualMatcher) FailureMessage(actual interface{}) (message string)
func (*BeSematicEqualMatcher) Match ¶ added in v0.1.0
func (matcher *BeSematicEqualMatcher) Match(actual interface{}) (success bool, err error)
func (*BeSematicEqualMatcher) NegatedFailureMessage ¶ added in v0.1.0
func (matcher *BeSematicEqualMatcher) NegatedFailureMessage(actual interface{}) (message string)
type Cleaner ¶ added in v0.16.0
type Cleaner struct {
// contains filtered or unexported fields
}
Cleaner is a struct to perform deletion of resources, enforcing removal of finalizers. Otherwise, deletion of namespaces wouldn't be possible. See: https://book.kubebuilder.io/reference/envtest.html#namespace-usage-limitation Based on https://github.com/kubernetes-sigs/controller-runtime/issues/880#issuecomment-749742403
func CreateCleaner ¶ added in v0.16.0
type Client ¶ added in v0.16.0
type Client struct {
client.Client
*envtest.Environment
*Cleaner
}
Client acts as a facade for setting up k8s envtest. It allows to wire controllers under tests through a simple builder funcs and configure underlying test environment through Option functions. It's composed of k8s client.Client and Cleaner to provide unified way of manipulating resources it the env test cluster.
func (*Client) UsingExistingCluster ¶ added in v0.16.0
type Config ¶ added in v0.16.0
type Config struct {
// contains filtered or unexported fields
}
func NewEnvTest ¶ added in v0.16.0
NewEnvTest prepares k8s EnvTest with prereq
func (*Config) Start ¶ added in v0.16.0
Start wires controller-runtime manager with controllers which are subject of the tests and starts Kubernetes EnvTest to verify their behavior.
func (*Config) WithControllers ¶ added in v0.16.0
WithControllers register controllers under tests required for the test suite.
func (*Config) WithWebhooks ¶ added in v0.16.0
WithWebhooks register webhooks under tests required for the test suite.
type Option ¶ added in v0.16.0
type Option func(target *envtest.Environment)
func WithScheme ¶ added in v0.16.0
func WithScheme(addToScheme ...AddToSchemeFunc) Option
WithScheme sets the scheme for the test environment.
func WithWebhookManifests ¶ added in v0.16.0
WithWebhookManifests adds CRDs to the test environment using paths.