testutils

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertErrorContains added in v0.3.0

func AssertErrorContains(str string) assert.ErrorAssertionFunc

AssertErrorContains returns assert.ErrorAssertionFunc that asserts that the error message contains str.

func AssertErrorIs added in v0.3.0

func AssertErrorIs(target error) assert.ErrorAssertionFunc

AssertErrorIs returns assert.ErrorAssertionFunc that asserts that the error is target.

func AssertErrorIsNotFound added in v0.3.0

func AssertErrorIsNotFound() assert.ErrorAssertionFunc

AssertErrorIsNotFound returns assert.ErrorAssertionFunc that asserts that the error is a NotFoundError.

func AssertValueAll added in v0.3.0

func AssertValueAll(fns ...assert.ValueAssertionFunc) assert.ValueAssertionFunc

AssertValueAll composes multiple assert.ValueAssertionFunc together.

func AssertValueContains added in v0.3.0

func AssertValueContains(contains interface{}) assert.ValueAssertionFunc

AssertValueContains returns assert.ValueAssertionFunc that asserts that the value contains the given contents.

func AssertValueJSONEq added in v0.3.0

func AssertValueJSONEq(expected any) assert.ValueAssertionFunc

AssertValueJSONEq returns assert.ValueAssertionFunc that asserts that two JSON strings are equivalent.

func MakeUID

func MakeUID(name string) types.UID

MakeUID returns a deterministically generated UID given an input string. nolint:gosec

func Mkmtime

func Mkmtime(value string) metav1.Time

Mkmtime parses a RFC3339 string or panics and returns a metav1.Time.

func Mkmtimep

func Mkmtimep(value string) *metav1.Time

Mkmtimep parses a RFC3339 string or panics and returns a *metav1.Time.

func Mktime

func Mktime(value string) time.Time

Mktime parses a RFC3339 string or panics and returns a time.Time.

func Mktimep

func Mktimep(value string) *time.Time

Mktimep parses a RFC3339 string or panics and returns a *time.Time.

func WantError added in v0.3.0

func WantError(t assert.TestingT, wantErr assert.ErrorAssertionFunc, err error, i ...interface{}) bool

WantError checks err against assert.ErrorAssertionFunc, returning true if an error was encountered for short-circuiting.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL