@@ -76,9 +76,27 @@ vet: ## Run go vet against code.
7676test : manifests generate fmt vet setup-envtest # # Run tests.
7777 KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) --bin-dir $( LOCALBIN) -p path) " go test $$(go list ./... | grep -v /e2e ) -coverprofile cover.out
7878
79- # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
80- .PHONY : test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
81- test-e2e : fluentd-e2e
79+ KIND_CLUSTER ?= fluent-operator-test-e2e
80+
81+ .PHONY : setup-test-e2e
82+ setup-test-e2e : $(KIND ) # # Set up a Kind cluster for e2e tests if it does not exist
83+ @case " $$ ($( KIND) get clusters)" in \
84+ * " $( KIND_CLUSTER) " * ) \
85+ echo " Kind cluster '$( KIND_CLUSTER) ' already exists. Skipping creation." ;; \
86+ * ) \
87+ echo " Creating Kind cluster '$( KIND_CLUSTER) '…" ; \
88+ $(KIND ) create cluster --name $(KIND_CLUSTER ) ;; \
89+ esac
90+
91+ .PHONY : cleanup-test-e2e
92+ cleanup-test-e2e :
93+ $(KIND ) delete cluster --name $(KIND_CLUSTER )
94+
95+ .PHONY : test-e2e
96+ test-e2e : setup-test-e2e fluentd-e2e # # Run the e2e tests against a Kind k8s instance that is spun up.
97+
98+ % -e2e : ginkgo
99+ @export KIND_CLUSTER=$(KIND_CLUSTER ) ; tests/scripts/$* _e2e.sh
82100
83101.PHONY : lint
84102lint : golangci-lint # # Run golangci-lint linter
@@ -230,7 +248,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
230248
231249.PHONY : setup-envtest
232250setup-envtest : envtest # # Download the binaries required for ENVTEST in the local bin directory.
233- @echo " Setting up envtest binaries for Kubernetes version $( ENVTEST_K8S_VERSION) ... "
251+ @echo " Setting up envtest binaries for Kubernetes version $( ENVTEST_K8S_VERSION) … "
234252 @$(ENVTEST ) use $(ENVTEST_K8S_VERSION ) --bin-dir $(LOCALBIN ) -p path || { \
235253 echo " Error: Failed to set up envtest binaries for version $( ENVTEST_K8S_VERSION) ." ; \
236254 exit 1; \
@@ -256,26 +274,6 @@ code-generator: $(CODE_GENERATOR) ## Download code-generator locally if necessar
256274$(CODE_GENERATOR ) : $(LOCALBIN )
257275 $(call go-install-tool,$(CODE_GENERATOR ) ,k8s.io/code-generator,$(CODE_GENERATOR_VERSION ) )
258276
259- KIND_CLUSTER ?= fluent-operator-test-e2e
260-
261- .PHONY : setup-test-e2e
262- setup-test-e2e : # # Set up a Kind cluster for e2e tests if it does not exist
263- @command -v $(KIND ) > /dev/null 2>&1 || { \
264- echo " Kind is not installed. Please install Kind manually." ; \
265- exit 1; \
266- }
267- @case " $$ ($( KIND) get clusters)" in \
268- * " $( KIND_CLUSTER) " * ) \
269- echo " Kind cluster '$( KIND_CLUSTER) ' already exists. Skipping creation." ;; \
270- * ) \
271- echo " Creating Kind cluster '$( KIND_CLUSTER) '..." ; \
272- $(KIND ) create cluster --name $(KIND_CLUSTER ) ;; \
273- esac
274-
275- .PHONY : cleanup-test-e2e
276- cleanup-test-e2e :
277- $(KIND ) delete cluster --name $(KIND_CLUSTER )
278-
279277.PHONY : kind
280278kind : $(KIND ) # # Download code-generator locally if necessary.
281279$(KIND ) : $(LOCALBIN )
@@ -375,12 +373,6 @@ go-deps: # download go dependencies
375373docs-update : # update api docs
376374 go run ./cmd/doc-gen/main.go
377375
378- fluentd-e2e : ginkgo # make e2e tests
379- tests/scripts/fluentd_e2e.sh
380-
381- fluentd-helm-e2e : ginkgo # make helm e2e tests
382- tests/scripts/fluentd_helm_e2e.sh
383-
384376update-helm-package : # update helm repo
385377 ./hack/update-helm-package.sh
386378
0 commit comments