Documentation ¶
Index ¶
- Variables
- func AssertEventNotRecordedforUnstruct(t *testing.T, c client.Client, unstruct *unstructured.Unstructured, ...)
- func AssertEventRecordedForObjectMetaAndKind(t *testing.T, c client.Client, kind string, om *metav1.ObjectMeta, ...)
- func AssertEventRecordedforUnstruct(t *testing.T, c client.Client, unstruct *unstructured.Unstructured, ...)
- func AssertLabelsMatchAndHaveManagedLabel(t *testing.T, actual, expected map[string]string)
- func AssertObservedGenerationEquals(t *testing.T, unstruct *unstructured.Unstructured, ...)
- func AssertReadyCondition(t *testing.T, conditions []condition.Condition)
- func AssertServerGeneratedResourceIDMatch(t *testing.T, reconciledResourceID string, ...)
- func AssertUserSpecifiedResourceIDMatch(t *testing.T, reconciledResourceID string, ...)
- func CollectEvents(t *testing.T, config *rest.Config, namespace string, expectedCount int, ...) []v1.Event
- func DeleteAllEventsForUnstruct(t *testing.T, c client.Client, unstruct *unstructured.Unstructured)
- func EnsureNamespaceExists(c client.Client, name string) error
- func EnsureNamespaceExistsT(t *testing.T, c client.Client, name string)
- func EnsureNamespaceHasProjectIDAnnotation(t *testing.T, c client.Client, namespaceName, projectId string)
- func GetCRDForKind(t *testing.T, kubeClient client.Client, kind string) *apiextensions.CustomResourceDefinition
- func GetResourceID(t *testing.T, resourceUnstruct *unstructured.Unstructured) (string, bool)
- func IsResourceIDFieldServerGenerated(rc *v1alpha1.ResourceConfig) bool
- func Name(t *testing.T) string
- func ReadFileToBytes(t *testing.T, yamlPath string) []byte
- func RemoveResourceID(u *unstructured.Unstructured)
- func ReplaceTestVars(t *testing.T, b []byte, uniqueId, projectId string) []byte
- func RunReconcilerAssertResults(t *testing.T, reconciler reconcile.Reconciler, objectMeta v1.ObjectMeta, ...)
- func SetResourceID(t *testing.T, u *unstructured.Unstructured, val string)
- func SetupNamespaceForDefaultProject(t *testing.T, c client.Client, name string)
- func SetupNamespaceForProject(t *testing.T, c client.Client, name, projectID string)
- func StartMgr(t *testing.T, mgr manager.Manager) func()
- func StartTestManagerInstance(env *envtest.Environment, testType test.TestType, ...) (manager.Manager, func())
- func SupportsResourceIDField(rc *v1alpha1.ResourceConfig) bool
- func UniqueName(t *testing.T, name string) string
- func WaitForUnstructDeleteToFinish(t *testing.T, kubeClient client.Client, ...)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AssertEventNotRecordedforUnstruct ¶
func AssertEventNotRecordedforUnstruct(t *testing.T, c client.Client, unstruct *unstructured.Unstructured, reason string)
func AssertEventRecordedforUnstruct ¶
func AssertEventRecordedforUnstruct(t *testing.T, c client.Client, unstruct *unstructured.Unstructured, reason string)
func AssertLabelsMatchAndHaveManagedLabel ¶
AssertLabelsMatchAndHaveManagedLabel checks that a given label appears in the label map.
func AssertObservedGenerationEquals ¶
func AssertObservedGenerationEquals(t *testing.T, unstruct *unstructured.Unstructured, preReconcileGeneration int64)
func AssertReadyCondition ¶
AssertReadyCondition checks that the given conditions slice contains a Ready condition.
func AssertServerGeneratedResourceIDMatch ¶
func AssertServerGeneratedResourceIDMatch(t *testing.T, reconciledResourceID string, appliedUnstruct *unstructured.Unstructured)
func AssertUserSpecifiedResourceIDMatch ¶
func AssertUserSpecifiedResourceIDMatch(t *testing.T, reconciledResourceID string, appliedUnstruct *unstructured.Unstructured)
func CollectEvents ¶
func CollectEvents(t *testing.T, config *rest.Config, namespace string, expectedCount int, timeout time.Duration) []v1.Event
Collects an expected number of events from the API server. The timeout is applied on a per-event basis, so it is possible this function takes upwards of expectedCount * timeoutSeconds duration to 'timeout'. When a timeout does occur, t.Fatal(...) is invoked.
func DeleteAllEventsForUnstruct ¶
func DeleteAllEventsForUnstruct(t *testing.T, c client.Client, unstruct *unstructured.Unstructured)
func EnsureNamespaceExistsT ¶
func GetCRDForKind ¶
func GetCRDForKind(t *testing.T, kubeClient client.Client, kind string) *apiextensions.CustomResourceDefinition
func GetResourceID ¶
func GetResourceID(t *testing.T, resourceUnstruct *unstructured.Unstructured) (string, bool)
func IsResourceIDFieldServerGenerated ¶
func IsResourceIDFieldServerGenerated(rc *v1alpha1.ResourceConfig) bool
TODO(kcc-eng): Clean up all the duplicate IsResourceIDFieldServerGenerated functions.
func RemoveResourceID ¶
func RemoveResourceID(u *unstructured.Unstructured)
func ReplaceTestVars ¶
ReplaceTestVars replaces all occurrences of placeholder strings e.g. ${uniqueId} in a given byte slice.
func RunReconcilerAssertResults ¶
func RunReconcilerAssertResults(t *testing.T, reconciler reconcile.Reconciler, objectMeta v1.ObjectMeta, expectedResult reconcile.Result, expectedErrorRegex *regexp.Regexp)
RunReconcilerAssertResults asserts the expected state of the reconciler run.
func SetResourceID ¶
func SetResourceID(t *testing.T, u *unstructured.Unstructured, val string)
func StartTestManagerInstance ¶
func StartTestManagerInstance(env *envtest.Environment, testType test.TestType, whCfgs []cnrmwebhook.WebhookConfig) (manager.Manager, func())
StartTestManager begins a new test manager, and returns a function to gracefully shutdown.
func SupportsResourceIDField ¶
func SupportsResourceIDField(rc *v1alpha1.ResourceConfig) bool
TODO(kcc-eng): Clean up all the duplicate SupportsResourceIDField functions.
func UniqueName ¶
UniqueName takes a name and returns a unique version.
func WaitForUnstructDeleteToFinish ¶
func WaitForUnstructDeleteToFinish(t *testing.T, kubeClient client.Client, origUnstruct *unstructured.Unstructured)
Types ¶
This section is empty.