Skip to content

Commit

Permalink
clean more
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Rae Kim <[email protected]>
  • Loading branch information
yiraeChristineKim committed Oct 27, 2023
1 parent d4cc204 commit 13a276b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion controllers/constraintstatus_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
21 changes: 20 additions & 1 deletion test/e2e/gatekeeper_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 13a276b

Please sign in to comment.