Documentation
¶
Overview ¶
Package helpers contains helper functions for unit tests.
Index ¶
- func Diff(want, got any) string
- func GetBoolPointer(b bool) *bool
- func GetHTTPMethodPointer(m v1beta1.HTTPMethod) *v1beta1.HTTPMethod
- func GetHeaderMatchTypePointer(t v1beta1.HeaderMatchType) *v1beta1.HeaderMatchType
- func GetInt32Pointer(i int32) *int32
- func GetIntPointer(i int) *int
- func GetPointer[T any](v T) *T
- func GetQueryParamMatchTypePointer(t v1beta1.QueryParamMatchType) *v1beta1.QueryParamMatchType
- func GetStringPointer(s string) *string
- func GetTLSModePointer(t v1beta1.TLSModeType) *v1beta1.TLSModeType
- func PrepareTimeForFakeClient(t metav1.Time) metav1.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
Diff prints the diff between two structs. It is useful in testing to compare two structs when they are large. In such a case, without Diff it will be difficult to pinpoint the difference between the two structs.
func GetBoolPointer ¶
GetBoolPointer takes a bool and returns a pointer to it.
func GetHTTPMethodPointer ¶
func GetHTTPMethodPointer(m v1beta1.HTTPMethod) *v1beta1.HTTPMethod
GetHTTPMethodPointer takes an HTTPMethod and returns a pointer to it.
func GetHeaderMatchTypePointer ¶
func GetHeaderMatchTypePointer(t v1beta1.HeaderMatchType) *v1beta1.HeaderMatchType
GetHeaderMatchTypePointer takes an HeaderMatchType and returns a pointer to it.
func GetInt32Pointer ¶
GetInt32Pointer takes an int32 and returns a pointer to it.
func GetIntPointer ¶
GetIntPointer takes an int and returns a pointer to it.
func GetPointer ¶
func GetPointer[T any](v T) *T
GetPointer takes a value of any type and returns a pointer to it.
func GetQueryParamMatchTypePointer ¶
func GetQueryParamMatchTypePointer(t v1beta1.QueryParamMatchType) *v1beta1.QueryParamMatchType
GetQueryParamMatchTypePointer takes an QueryParamMatchType and returns a pointer to it.
func GetStringPointer ¶
GetStringPointer takes a string and returns a pointer to it.
func GetTLSModePointer ¶
func GetTLSModePointer(t v1beta1.TLSModeType) *v1beta1.TLSModeType
GetTLSModePointer takes a TLSModeType and returns a pointer to it.
func PrepareTimeForFakeClient ¶
PrepareTimeForFakeClient processes the time similarly to the fake client from sigs.k8s.io/controller-runtime/pkg/client/fake making it is possible to use it in tests when comparing against values returned by the fake client. It panics if it fails to process the time.
Types ¶
This section is empty.