Documentation ¶
Index ¶
- func AssertEqual(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{})
- func AssertNotEqual(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{})
- func Equal(expected interface{}) *cmpMatcher
- func EqualErrorString(err string) equalErrorString
- func EqualErrorType(err error) equalErrorType
- func NewFakeRESTMapper(gvks ...schema.GroupVersionKind) meta.RESTMapper
- func ToIdentifier(t *testing.T, manifest string) object.ObjMetadata
- func Unstructured(t *testing.T, manifest string, mutators ...Mutator) *unstructured.Unstructured
- func VerifyEvents(expEvents []ExpEvent, events []event.Event) error
- type ExpActionGroupEvent
- type ExpApplyEvent
- type ExpDeleteEvent
- type ExpErrorEvent
- type ExpEvent
- type ExpInitEvent
- type ExpPruneEvent
- type ExpStatusEvent
- type ExpWaitEvent
- type GroupedEventsByID
- type Mutator
- type TestFilesystem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEqual ¶ added in v0.26.0
AssertEqual fails the test if the actual value does not deeply equal the expected value. Prints a diff on failure.
func AssertNotEqual ¶ added in v0.26.0
AssertNotEqual fails the test if the actual value deeply equals the expected value. Prints a diff on failure.
func Equal ¶ added in v0.26.0
func Equal(expected interface{}) *cmpMatcher
Equal returns a matcher for use with Gomega that uses go-cmp's cmp.Equal to compare and cmp.Diff to show the difference, if there is one.
Example Usage: Expect(receivedEvents).To(testutil.Equal(expectedEvents))
func EqualErrorString ¶ added in v0.26.0
func EqualErrorString(err string) equalErrorString
EqualErrorString returns an error with an Is(error)bool function that matches any error with the same Error() as the supplied string value.
Use with testutil.Equal to handle error comparisons.
func EqualErrorType ¶ added in v0.26.0
func EqualErrorType(err error) equalErrorType
EqualErrorType returns an error with an Is(error)bool function that matches any error with the same type as the supplied error.
Use with testutil.Equal to handle error comparisons.
func NewFakeRESTMapper ¶ added in v0.14.0
func NewFakeRESTMapper(gvks ...schema.GroupVersionKind) meta.RESTMapper
func ToIdentifier ¶ added in v0.26.0
func ToIdentifier(t *testing.T, manifest string) object.ObjMetadata
ToIdentifier translates object yaml config into ObjMetadata.
func Unstructured ¶ added in v0.26.0
func Unstructured(t *testing.T, manifest string, mutators ...Mutator) *unstructured.Unstructured
Unstructured translates the passed object config string into an object in Unstructured format. The mutators modify the config yaml before returning the object.
Types ¶
type ExpActionGroupEvent ¶ added in v0.26.0
type ExpActionGroupEvent struct { GroupName string Action event.ResourceAction Type event.ActionGroupEventType }
type ExpApplyEvent ¶ added in v0.26.0
type ExpApplyEvent struct { GroupName string Operation event.ApplyEventOperation Identifier object.ObjMetadata Error error }
type ExpDeleteEvent ¶ added in v0.26.0
type ExpDeleteEvent struct { GroupName string Operation event.DeleteEventOperation Identifier object.ObjMetadata Error error }
type ExpErrorEvent ¶ added in v0.26.0
type ExpErrorEvent struct {
Err error
}
type ExpEvent ¶ added in v0.26.0
type ExpEvent struct { EventType event.Type InitEvent *ExpInitEvent ErrorEvent *ExpErrorEvent ActionGroupEvent *ExpActionGroupEvent ApplyEvent *ExpApplyEvent StatusEvent *ExpStatusEvent PruneEvent *ExpPruneEvent DeleteEvent *ExpDeleteEvent WaitEvent *ExpWaitEvent }
func EventToExpEvent ¶ added in v0.26.0
func EventsToExpEvents ¶ added in v0.26.0
type ExpInitEvent ¶ added in v0.26.0
type ExpInitEvent struct { }
type ExpPruneEvent ¶ added in v0.26.0
type ExpPruneEvent struct { GroupName string Operation event.PruneEventOperation Identifier object.ObjMetadata Error error }
type ExpStatusEvent ¶ added in v0.26.0
type ExpStatusEvent struct { Identifier object.ObjMetadata Status status.Status Error error }
type ExpWaitEvent ¶ added in v0.26.1
type ExpWaitEvent struct { GroupName string Operation event.WaitEventOperation Identifier object.ObjMetadata }
type GroupedEventsByID ¶ added in v0.26.0
type GroupedEventsByID []ExpEvent
GroupedEventsByID implements sort.Interface for []ExpEvent based on the serialized ObjMetadata of Apply, Prune, and Delete events within the same task group. This makes testing events easier, because apply/prune/delete order is non-deterministic within each task group. This is only needed if you expect to have multiple apply/prune/delete events in the same task group.
func (GroupedEventsByID) Len ¶ added in v0.26.0
func (ape GroupedEventsByID) Len() int
func (GroupedEventsByID) Less ¶ added in v0.26.0
func (ape GroupedEventsByID) Less(i, j int) bool
func (GroupedEventsByID) Swap ¶ added in v0.26.0
func (ape GroupedEventsByID) Swap(i, j int)
type Mutator ¶ added in v0.26.0
type Mutator interface {
Mutate(u *unstructured.Unstructured)
}
Mutator inteface defines a function to update an object while translating it unto Unstructured format from yaml config.
func AddDependsOn ¶ added in v0.26.0
func AddDependsOn(t *testing.T, deps ...object.ObjMetadata) Mutator
AddDependsOn returns a testutil.Mutator which adds the passed objects as a depends-on annotation to the object which is mutated. Multiple objects passed in means multiple depends on objects in the annotation separated by a comma.
type TestFilesystem ¶
type TestFilesystem struct {
// contains filtered or unexported fields
}
TestFilesystem creates directories and files for testing
func Setup ¶
func Setup(t *testing.T, dirs ...string) TestFilesystem
Setupd creates directories in the test filesystem, returning the TestFilesystem.
func (TestFilesystem) GetRootDir ¶
func (tf TestFilesystem) GetRootDir() string
GetRootDir returns the path to the root of the test filesystem.