Documentation ¶
Index ¶
- Constants
- func AssertEqualsField(t *testing.T, a, b model.Field)
- func AssertEqualsResource(t *testing.T, a, b model.Resource)
- func AssertEqualsResourcePter(t *testing.T, a, b *model.Resource)
- func AssertEqualsResources(t *testing.T, a, b model.Resources)
- func AssertEqualsTag(t *testing.T, a, b *model.Tag)
- func AssertEqualsTags(t *testing.T, a, b model.Tags)
- func AssertEvent(t *testing.T, ee, ae model.Event)
- func AssertResourceCount(t TestingTB, resources []model.Resource, tagValue string, count int)
- func AssertResourceFilteredCount(t TestingTB, resources []model.Resource, count int, filter ResourceFilter) []model.Resource
- func FetchAll[T any](ctx context.Context, t TestingTB, f func(context.Context, chan<- T) error) ([]T, error)
- func FilterFunc[T any](in []T, predicate func(T) bool) []T
- func FuncSignature(value any) string
- func JSONBytesEqual(a, b []byte) (bool, error)
- func MustFetchAll[T any](ctx context.Context, t TestingTB, f func(context.Context, chan<- T) error) []T
- func ResourceFilterTagKey(in []model.Resource, key string) []model.Resource
- func ResourceFilterTagKeyValue(in []model.Resource, key, value string) []model.Resource
- func SliceConvertFunc[In any, Out any, T ~[]In](in T, f func(In) Out) []Out
- func TypeStr(v any) string
- func Unique[T comparable](in []T) []T
- type ResourceFilter
- type TestingTB
Constants ¶
const TestTag = "test"
Variables ¶
This section is empty.
Functions ¶
func AssertResourceCount ¶
AssertResourceCount asserts that there is a specific number of given resources with the "test" tag. If tagValue is not an empty string, it also filters on resources that have the "test" tag with that value.
func FetchAll ¶
func FetchAll[T any](ctx context.Context, t TestingTB, f func(context.Context, chan<- T) error) ([]T, error)
FetchAll pulls all resources from `f` over the passed channel, returning the resources as a slice
func FilterFunc ¶
FilterFunc filters a slice based on the predicate function
func FuncSignature ¶
FuncSignature returns the signature of a function as a string, useful for error messages.
func JSONBytesEqual ¶
JSONBytesEqual compares the JSON in two byte slices.
func MustFetchAll ¶
func MustFetchAll[T any](ctx context.Context, t TestingTB, f func(context.Context, chan<- T) error) []T
MustFetchAll is like FetchAll, but fatals the running test if there is an error during fetching
func ResourceFilterTagKey ¶
ResourceFilterTagKey filters a slice of model.Resources based on a given tag key being present on that resource.
func ResourceFilterTagKeyValue ¶
ResourceFilterTagKey filters a slice of model.Resources based on a given tag key/value pair being present on that resource.
func SliceConvertFunc ¶
func TypeStr ¶
TypeStr is a convenience function to get the fully qualified type identifier for a value
func Unique ¶
func Unique[T comparable](in []T) []T
Unique returns a new slice with duplicate elements removed and the order preserved.
Types ¶
type ResourceFilter ¶
type ResourceFilter struct { AccountId string Region string Type string DisplayIdPrefix string Tags model.Tags RawData map[string]any }
func (ResourceFilter) PartialFilter ¶ added in v0.2.0
PartialFilter returns a more detailed filtering of the resources, with filter field processed separately. This can aid in debugging to determine why a resource isn't matching a given filter.
func (ResourceFilter) String ¶
func (f ResourceFilter) String() string