diff --git a/Makefile b/Makefile index 49def4a8..65eea96a 100644 --- a/Makefile +++ b/Makefile @@ -146,7 +146,7 @@ test: manifests generate fmt vet envtest ## Run tests. LABEL_FILTER=gatekeeper-controller .PHONY: test-e2e test-e2e: e2e-dependencies generate fmt vet ## Run e2e tests, using the configured Kubernetes cluster in ~/.kube/config - GOFLAGS=$(GOFLAGS) USE_EXISTING_CLUSTER=true $(GINKGO) --trace --fail-fast --label-filter="$(LABEL_FILTER)" ./test/e2e -- --namespace="$(NAMESPACE)" --timeout="5m" --delete-timeout="10m" + GOFLAGS=$(GOFLAGS) USE_EXISTING_CLUSTER=true $(GINKGO) -v --trace --fail-fast --label-filter="$(LABEL_FILTER)" ./test/e2e -- --namespace="$(NAMESPACE)" --timeout="5m" --delete-timeout="10m" .PHONY: test-cluster test-cluster: ## Create a local kind cluster with a registry for testing diff --git a/controllers/constraintstatus_controller.go b/controllers/constraintstatus_controller.go index fe108830..c6625e50 100644 --- a/controllers/constraintstatus_controller.go +++ b/controllers/constraintstatus_controller.go @@ -80,7 +80,7 @@ func (r *ConstraintStatusReconciler) SetupWithManager(mgr ctrl.Manager) error { } // User set gatekeeper.spec.audit.auditFromCache to Automatic, this reconcile function -// collect all constraints and add found kinds which is used in contraint to config.spec.sync.syncOnly +// collect requested constraints and add found kinds which is used in contraint to config.spec.sync.syncOnly func (r *ConstraintStatusReconciler) Reconcile(ctx context.Context, request reconcile.Request, ) (reconcile.Result, error) { diff --git a/test/e2e/gatekeeper_controller_test.go b/test/e2e/gatekeeper_controller_test.go index de09d532..99ee63b5 100644 --- a/test/e2e/gatekeeper_controller_test.go +++ b/test/e2e/gatekeeper_controller_test.go @@ -102,6 +102,25 @@ var _ = Describe("Gatekeeper", Label("gatekeeper-controller"), func() { if err == nil { return false } + + return apierrors.IsNotFound(err) + }, deleteTimeout, pollInterval).Should(BeTrue()) + + Eventually(func() bool { + err := K8sClient.Get(ctx, auditName, &appsv1.Deployment{}) + if err == nil { + return false + } + + return apierrors.IsNotFound(err) + }, deleteTimeout, pollInterval).Should(BeTrue()) + + Eventually(func() bool { + err := K8sClient.Get(ctx, controllerManagerName, &appsv1.Deployment{}) + if err == nil { + return false + } + return apierrors.IsNotFound(err) }, deleteTimeout, pollInterval).Should(BeTrue()) }) @@ -490,7 +509,7 @@ func gatekeeperAuditDeployment() (auditDeployment *appsv1.Deployment) { auditDeployment = &appsv1.Deployment{} Eventually(func() error { return K8sClient.Get(ctx, auditName, auditDeployment) - }, timeout, pollInterval).ShouldNot(HaveOccurred()) + }, timeout*2, pollInterval).ShouldNot(HaveOccurred()) return }