Documentation ¶
Index ¶
- func ConsistOfHeaders(headers http.Header) types.GomegaMatcher
- func ContainCustomResource(typeMetaMatcher, objectMetaMatcher, specMatcher types.GomegaMatcher) types.GomegaMatcher
- func ContainCustomResourceType(gvk schema.GroupVersionKind) types.GomegaMatcher
- func ContainHeaderKeys(keys []string) types.GomegaMatcher
- func ContainHeaderKeysExact(keys []string) types.GomegaMatcher
- func ContainHeaders(headers http.Header) types.GomegaMatcher
- func ContainMapElements[keyT comparable, valT any](m map[keyT]valT) types.GomegaMatcher
- func ContainSubstrings(substrings []string) types.GomegaMatcher
- func HaveAcceptedState() types.GomegaMatcher
- func HaveExactResponseBody(body string) types.GomegaMatcher
- func HaveHttpResponse(expected *HttpResponse) types.GomegaMatcher
- func HaveKubeGatewayRouteStatus(expected *KubeGatewayRouteStatus) types.GomegaMatcher
- func HaveMedianLessThan(upperBound time.Duration) types.GomegaMatcher
- func HaveNameAndNamespace(name string, namespace string) types.GomegaMatcher
- func HaveNamespacedStatuses(expected *SoloKitNamespacedStatuses) types.GomegaMatcher
- func HaveNilManagedFields() types.GomegaMatcher
- func HaveOkResponse() types.GomegaMatcher
- func HaveOkResponseWithHeaders(headers map[string]interface{}) types.GomegaMatcher
- func HavePartialResponseBody(substring string) types.GomegaMatcher
- func HavePercentileLessThan(percentile int, upperBound time.Duration) types.GomegaMatcher
- func HavePercentileWithin(percentile int, target, window time.Duration) types.GomegaMatcher
- func HaveReasonSubstrings(reasons ...string) types.GomegaMatcher
- func HaveRejectedStateWithReasonSubstrings(reasons ...string) types.GomegaMatcher
- func HaveReportedBy(reporter string) types.GomegaMatcher
- func HaveState(state core.Status_State) types.GomegaMatcher
- func HaveStatus(expected *SoloKitStatus) types.GomegaMatcher
- func HaveStatusCode(statusCode int) types.GomegaMatcher
- func HaveStatusInNamespace(ns string, status *core.Status) types.GomegaMatcher
- func HaveSubResourceStatusState(subResourceName string, subResourceStatus SoloKitSubresourceStatus) types.GomegaMatcher
- func HaveWarningStateWithReasonSubstrings(reasons ...string) types.GomegaMatcher
- func MatchClientObject(gvk schema.GroupVersionKind, namespacedName k8stypes.NamespacedName, ...) types.GomegaMatcher
- func MatchClientObjectGvk(gvk schema.GroupVersionKind) types.GomegaMatcher
- func MatchCustomResource(typeMetaMatcher, objectMetaMatcher, specMatcher types.GomegaMatcher) types.GomegaMatcher
- func MatchObjectMeta(namespacedName k8stypes.NamespacedName, ...) types.GomegaMatcher
- func MatchStatusInNamespace(ns string, matcher types.GomegaMatcher) types.GomegaMatcher
- func MatchTypeMeta(gvk schema.GroupVersionKind) types.GomegaMatcher
- func PodMatches(pod ExpectedPod) types.GomegaMatcher
- type BeEquivalentToDiffMatcher
- type ExpectedPod
- type HaveHttpResponseMatcher
- type HaveKubeGatewayRouteStatusMatcher
- type HaveNamespacedStatusesMatcher
- type HaveStatusMatcher
- type HttpResponse
- type KubeGatewayRouteStatus
- type SoloKitNamespacedStatuses
- type SoloKitStatus
- type SoloKitSubresourceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsistOfHeaders ¶ added in v1.14.20
func ConsistOfHeaders(headers http.Header) types.GomegaMatcher
ConsistOfHeaders produces a matcher that will only match if all provided headers are completely accounted for, including multi-value headers. This matcher will fail if there are any extra headers that are not specified in the headers passed in.
func ContainCustomResource ¶ added in v1.17.4
func ContainCustomResource(typeMetaMatcher, objectMetaMatcher, specMatcher types.GomegaMatcher) types.GomegaMatcher
ContainCustomResource returns a GomegaMatcher which matches resource in a list if the provided typeMeta, objectMeta and spec matchers match This method is purely syntactic sugar around combining ContainElement and MatchCustomResource
func ContainCustomResourceType ¶ added in v1.17.4
func ContainCustomResourceType(gvk schema.GroupVersionKind) types.GomegaMatcher
ContainCustomResourceType returns a GomegaMatcher which matches resource in a list if the provided typeMeta match
func ContainHeaderKeys ¶ added in v1.15.12
func ContainHeaderKeys(keys []string) types.GomegaMatcher
ContainHeaderKeys produces a matcher that will only match if all provided header keys exist.
func ContainHeaderKeysExact ¶ added in v1.15.28
func ContainHeaderKeysExact(keys []string) types.GomegaMatcher
ContainHeaderKeysExact produces a matcher that will only match if all provided header keys exist and no others.
func ContainHeaders ¶
func ContainHeaders(headers http.Header) types.GomegaMatcher
ContainHeaders produces a matcher that will only match if all provided headers are completely accounted for, including multi-value headers.
func ContainMapElements ¶ added in v1.17.0
func ContainMapElements[keyT comparable, valT any](m map[keyT]valT) types.GomegaMatcher
ContainMapElements produces a matcher that will only match if all provided map elements are completely accounted for. The actual value is expected to not be nil or empty since there are other, more appropriate matchers for those cases.
func ContainSubstrings ¶
func ContainSubstrings(substrings []string) types.GomegaMatcher
ContainSubstrings produces a matcher that will match if all provided strings occur within the targeted string
func HaveAcceptedState ¶ added in v1.17.0
func HaveAcceptedState() types.GomegaMatcher
func HaveExactResponseBody ¶
func HaveExactResponseBody(body string) types.GomegaMatcher
HaveExactResponseBody expects a 200 response with a body that matches the provided string
func HaveHttpResponse ¶
func HaveHttpResponse(expected *HttpResponse) types.GomegaMatcher
HaveHttpResponse returns a GomegaMatcher which validates that an http.Response contains particular expected properties (status, body..etc) If an expected body isn't specified, the body is not matched
func HaveKubeGatewayRouteStatus ¶ added in v1.17.0
func HaveKubeGatewayRouteStatus(expected *KubeGatewayRouteStatus) types.GomegaMatcher
HaveKubeGatewayRouteStatus produces a matcher that will match if the provided status matches the actual status
func HaveMedianLessThan ¶ added in v1.15.0
func HaveMedianLessThan(upperBound time.Duration) types.GomegaMatcher
HaveMedianLessThan returns a matcher requiring the given slice of durations have a median value less than the given upperBound
func HaveNameAndNamespace ¶ added in v1.17.0
func HaveNameAndNamespace(name string, namespace string) types.GomegaMatcher
HaveNameAndNamespace returns a matcher that will match a pointer to a client.Object with the given name and namespace
func HaveNamespacedStatuses ¶ added in v1.17.0
func HaveNamespacedStatuses(expected *SoloKitNamespacedStatuses) types.GomegaMatcher
func HaveNilManagedFields ¶ added in v1.17.4
func HaveNilManagedFields() types.GomegaMatcher
HaveNilManagedFields returns a GomegaMatcher which matches a struct that has a `ManagedFields` property, which is nil This should be used with the above MatchObjectMeta, and can be passed as an additionalMetaMatcher: MatchObjectMeta(NamespacedName{Name:n,Namespace:ns}, HaveNilManagedFields())
func HaveOkResponse ¶
func HaveOkResponse() types.GomegaMatcher
HaveOkResponse expects a http response with a 200 status code
func HaveOkResponseWithHeaders ¶
func HaveOkResponseWithHeaders(headers map[string]interface{}) types.GomegaMatcher
HaveOkResponseWithHeaders expects an 200 response with a set of headers that match the provided headers
func HavePartialResponseBody ¶
func HavePartialResponseBody(substring string) types.GomegaMatcher
HavePartialResponseBody expects a 200 response with a body that contains the provided substring
func HavePercentileLessThan ¶ added in v1.15.0
func HavePercentileLessThan(percentile int, upperBound time.Duration) types.GomegaMatcher
HavePercentileLessThan returns a matcher requiring the given slice of durations to be less than the given upperBound at the given percentile
func HavePercentileWithin ¶ added in v1.15.0
func HavePercentileWithin(percentile int, target, window time.Duration) types.GomegaMatcher
HavePercentileWithin returns a matcher requiring the given slice of durations to be within a window of a given target at the given percentile
func HaveReasonSubstrings ¶ added in v1.17.0
func HaveReasonSubstrings(reasons ...string) types.GomegaMatcher
func HaveRejectedStateWithReasonSubstrings ¶ added in v1.17.0
func HaveRejectedStateWithReasonSubstrings(reasons ...string) types.GomegaMatcher
func HaveReportedBy ¶ added in v1.17.0
func HaveReportedBy(reporter string) types.GomegaMatcher
func HaveState ¶ added in v1.17.0
func HaveState(state core.Status_State) types.GomegaMatcher
func HaveStatus ¶ added in v1.17.0
func HaveStatus(expected *SoloKitStatus) types.GomegaMatcher
HaveStatus produces a matcher that will match if the provided status matches the actual status
func HaveStatusCode ¶
func HaveStatusCode(statusCode int) types.GomegaMatcher
HaveStatusCode expects a http response with a particular status code
func HaveStatusInNamespace ¶ added in v1.17.0
func HaveStatusInNamespace(ns string, status *core.Status) types.GomegaMatcher
func HaveSubResourceStatusState ¶ added in v1.17.2
func HaveSubResourceStatusState(subResourceName string, subResourceStatus SoloKitSubresourceStatus) types.GomegaMatcher
func HaveWarningStateWithReasonSubstrings ¶ added in v1.17.0
func HaveWarningStateWithReasonSubstrings(reasons ...string) types.GomegaMatcher
func MatchClientObject ¶ added in v1.17.4
func MatchClientObject(gvk schema.GroupVersionKind, namespacedName k8stypes.NamespacedName, customMatchers ...types.GomegaMatcher) types.GomegaMatcher
func MatchClientObjectGvk ¶ added in v1.17.4
func MatchClientObjectGvk(gvk schema.GroupVersionKind) types.GomegaMatcher
func MatchCustomResource ¶ added in v1.17.4
func MatchCustomResource(typeMetaMatcher, objectMetaMatcher, specMatcher types.GomegaMatcher) types.GomegaMatcher
MatchCustomResource returns a GomegaMatcher which matches a resource if the provided typeMeta, objectMeta and spec matchers match CAUTION TO DEVELOPERS!! When passing the specMatcher, keep in mind that the Spec is a pointer, so if you are asserting some behavior, you will likely need to wrap your matcher in: gstruct.PointTo({matcher})
func MatchObjectMeta ¶ added in v1.17.4
func MatchObjectMeta(namespacedName k8stypes.NamespacedName, additionalMetaMatchers ...types.GomegaMatcher) types.GomegaMatcher
MatchObjectMeta returns a GomegaMatcher which matches a struct that has the provided name/namespace This should be used when asserting that a CustomResource has a provided name/namespace
func MatchStatusInNamespace ¶ added in v1.17.0
func MatchStatusInNamespace(ns string, matcher types.GomegaMatcher) types.GomegaMatcher
MatchStatusInNamespace will create a matcher that allows a *HaveStatusMatcher generated from this package to be matched against the provided namespace in a HaveNamespacedStatusesMatcher
func MatchTypeMeta ¶ added in v1.17.4
func MatchTypeMeta(gvk schema.GroupVersionKind) types.GomegaMatcher
MatchTypeMeta returns a GomegaMatcher which matches a struct that has the provide Group/Version/Kind
func PodMatches ¶ added in v1.17.0
func PodMatches(pod ExpectedPod) types.GomegaMatcher
PodMatches returns a GomegaMatcher that checks whether a pod
Types ¶
type BeEquivalentToDiffMatcher ¶
type BeEquivalentToDiffMatcher struct {
matchers.BeEquivalentToMatcher
}
func BeEquivalentToDiff ¶
func BeEquivalentToDiff(expected interface{}) *BeEquivalentToDiffMatcher
BeEquivalentToDiff is the same as BeEquivalentTo but prints a nice diff on failure best effect use ginkgo with -noColor
func (*BeEquivalentToDiffMatcher) FailureMessage ¶
func (matcher *BeEquivalentToDiffMatcher) FailureMessage(actual interface{}) (message string)
func (*BeEquivalentToDiffMatcher) NegatedFailureMessage ¶
func (matcher *BeEquivalentToDiffMatcher) NegatedFailureMessage(actual interface{}) (message string)
type ExpectedPod ¶ added in v1.17.0
type ExpectedPod struct { // ContainerName is the name of the container. Optional. ContainerName string // Status is the pod phase status (e.g. Running, Pending, Succeeded, Failed). Optional. Status corev1.PodPhase }
ExpectedPod is a struct that represents the expected pod.
type HaveHttpResponseMatcher ¶
type HaveHttpResponseMatcher struct { Expected *HttpResponse // contains filtered or unexported fields }
func (*HaveHttpResponseMatcher) FailureMessage ¶
func (m *HaveHttpResponseMatcher) FailureMessage(actual interface{}) (message string)
func (*HaveHttpResponseMatcher) Match ¶
func (m *HaveHttpResponseMatcher) Match(actual interface{}) (success bool, err error)
func (*HaveHttpResponseMatcher) NegatedFailureMessage ¶
func (m *HaveHttpResponseMatcher) NegatedFailureMessage(actual interface{}) (message string)
type HaveKubeGatewayRouteStatusMatcher ¶ added in v1.17.0
type HaveKubeGatewayRouteStatusMatcher struct { Expected *KubeGatewayRouteStatus // contains filtered or unexported fields }
func (*HaveKubeGatewayRouteStatusMatcher) FailureMessage ¶ added in v1.17.0
func (m *HaveKubeGatewayRouteStatusMatcher) FailureMessage(actual interface{}) (message string)
func (*HaveKubeGatewayRouteStatusMatcher) Match ¶ added in v1.17.0
func (m *HaveKubeGatewayRouteStatusMatcher) Match(actual interface{}) (success bool, err error)
func (*HaveKubeGatewayRouteStatusMatcher) NegatedFailureMessage ¶ added in v1.17.0
func (m *HaveKubeGatewayRouteStatusMatcher) NegatedFailureMessage(actual interface{}) (message string)
type HaveNamespacedStatusesMatcher ¶ added in v1.17.0
type HaveNamespacedStatusesMatcher struct { Expected *SoloKitNamespacedStatuses // contains filtered or unexported fields }
func (*HaveNamespacedStatusesMatcher) FailureMessage ¶ added in v1.17.0
func (m *HaveNamespacedStatusesMatcher) FailureMessage(actual interface{}) (message string)
func (*HaveNamespacedStatusesMatcher) Match ¶ added in v1.17.0
func (m *HaveNamespacedStatusesMatcher) Match(actual interface{}) (success bool, err error)
func (*HaveNamespacedStatusesMatcher) NegatedFailureMessage ¶ added in v1.17.0
func (m *HaveNamespacedStatusesMatcher) NegatedFailureMessage(actual interface{}) (message string)
type HaveStatusMatcher ¶ added in v1.17.0
type HaveStatusMatcher struct { Expected *SoloKitStatus // contains filtered or unexported fields }
func (*HaveStatusMatcher) FailureMessage ¶ added in v1.17.0
func (m *HaveStatusMatcher) FailureMessage(actual interface{}) (message string)
func (*HaveStatusMatcher) Match ¶ added in v1.17.0
func (m *HaveStatusMatcher) Match(actual interface{}) (success bool, err error)
func (*HaveStatusMatcher) NegatedFailureMessage ¶ added in v1.17.0
func (m *HaveStatusMatcher) NegatedFailureMessage(actual interface{}) (message string)
type HttpResponse ¶
type HttpResponse struct { // StatusCode is the expected status code for an http.Response // Required StatusCode int // Body is the expected response body for an http.Response // Body can be of type: {string, bytes, GomegaMatcher} // Optional: If not provided, defaults to an empty string Body interface{} // Headers is the set of expected header values for an http.Response // Each header can be of type: {string, GomegaMatcher} // Optional: If not provided, does not perform header validation Headers map[string]interface{} // Custom is a generic matcher that can be applied to validate any other properties of an http.Response // Optional: If not provided, does not perform additional validation Custom types.GomegaMatcher }
HttpResponse defines the set of properties that we can validate from an http.Response
func (*HttpResponse) String ¶ added in v1.17.0
func (r *HttpResponse) String() string
type KubeGatewayRouteStatus ¶ added in v1.17.0
type KubeGatewayRouteStatus struct { // Custom is a generic matcher that can be applied to validate any other properties of a k8s gateway RouteStatus // Optional: If not provided, does not perform additional validation Custom types.GomegaMatcher }
KubeGatewayRouteStatus defines the set of properties that we can validate from a k8s gateway RouteStatus
type SoloKitNamespacedStatuses ¶ added in v1.17.0
type SoloKitNamespacedStatuses struct {
Statuses map[string]*SoloKitStatus
}
SoloKitNamespacedStatuses defines the set of properties that we can validate from a core.NamespacedStatuses
type SoloKitStatus ¶ added in v1.17.0
type SoloKitStatus struct { State *core.Status_State Reason string ReportedBy string SubresourceStatuses map[string]SoloKitSubresourceStatus // TODO: implement as needed // Details *structpb.Struct // Messages []string // Custom is a generic matcher that can be applied to validate any other properties of a core.Status // Optional: If not provided, does not perform additional validation Custom types.GomegaMatcher }
SoloKitStatus defines the set of properties that we can validate from a core.Status
type SoloKitSubresourceStatus ¶ added in v1.17.2
SoloKitSubresourceStatus is a struct for subresource status fields