Documentation ¶
Index ¶
- func AssertErrorMatch(t *testing.T, s string, e error)
- func AssertInventoryHasItems(t *testing.T, gs *templatesv1.GitOpsSet, objs ...runtime.Object)
- func AssertNoError(t *testing.T, err error)
- func AssertNotFound(t *testing.T, err error)
- func MakeTestKustomization(name types.NamespacedName, opts ...func(*kustomizev1.Kustomization)) *kustomizev1.Kustomization
- func MatchErrorString(t *testing.T, s string, e error) bool
- func NewConfigMap(opts ...func(*corev1.ConfigMap)) *corev1.ConfigMap
- func NewGitRepository(opts ...func(*sourcev1.GitRepository)) *sourcev1.GitRepository
- func NewImagePolicy(opts ...func(*imagev1.ImagePolicy)) *imagev1.ImagePolicy
- func NewNamespace(name string, opts ...func(*corev1.Namespace)) *corev1.Namespace
- func NewSecret(opts ...func(*corev1.Secret)) *corev1.Secret
- func StartFakeArchiveServer(t *testing.T, dir string) *httptest.Server
- func ToUnstructured(t *testing.T, obj runtime.Object) *unstructured.Unstructured
- type EventData
- type FakeEventRecorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertErrorMatch ¶
AssertErrorMatch will fail if the error doesn't match the provided error.
func AssertInventoryHasItems ¶
AssertInventoryHasItems will ensure that each of the provided objects is listed in the Inventory of the provided GitOpsSet.
func AssertNoError ¶
AssertNoError will fail if the provided err value is an error.
func AssertNotFound ¶
AssertNotFound will fail if the provided err value not a NotFound error from the K8s client API.
func MakeTestKustomization ¶
func MakeTestKustomization(name types.NamespacedName, opts ...func(*kustomizev1.Kustomization)) *kustomizev1.Kustomization
func MatchErrorString ¶
MatchErrorString takes a string and matches on the error and returns true if the string matches the error.
This is useful in table tests.
If the string can't be compiled as an regexp, then this will fail with a Fatal error.
func NewConfigMap ¶
NewConfigMap creates and returns a new ConfigMap.
func NewGitRepository ¶
func NewGitRepository(opts ...func(*sourcev1.GitRepository)) *sourcev1.GitRepository
NewGitRepository creates and returns a new GitRepository.
func NewImagePolicy ¶
func NewImagePolicy(opts ...func(*imagev1.ImagePolicy)) *imagev1.ImagePolicy
NewImagePolicy creates and returns a new Flux ImagePolicy.
func NewNamespace ¶
NewNamespace creates a new namespace with the provided name.
func StartFakeArchiveServer ¶
StartFakeArchiveServer starts an http server that serves the provided directory.
func ToUnstructured ¶
func ToUnstructured(t *testing.T, obj runtime.Object) *unstructured.Unstructured
ToUnstructured converts a k8s Object to an Unstructured.
It also removes the "status" field from the Unstructured representation.
Types ¶
type FakeEventRecorder ¶
type FakeEventRecorder struct {
Events []*EventData
}
FakeEventRecorder is a fake event recorder used in tests to simulate recording the events in a slice of EventData
func (*FakeEventRecorder) Event ¶
func (f *FakeEventRecorder) Event(object runtime.Object, eventtype, reason, message string)
Event records a new event in the slice of the fake event recorder used in a test The interface using Event is the EventRecorder interface
func (*FakeEventRecorder) Reset ¶
func (f *FakeEventRecorder) Reset()
Reset resets the slice of the fake event recorder used in a test