@@ -76,10 +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 :
82- go test ./tests/e2e/ -v -ginkgo.v
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 ) ; export PATH=" $$ PWD/bin:$$ PATH" ; tests/scripts/$* _e2e.sh
83100
84101.PHONY : lint
85102lint : golangci-lint # # Run golangci-lint linter
@@ -231,7 +248,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
231248
232249.PHONY : setup-envtest
233250setup-envtest : envtest # # Download the binaries required for ENVTEST in the local bin directory.
234- @echo " Setting up envtest binaries for Kubernetes version $( ENVTEST_K8S_VERSION) ... "
251+ @echo " Setting up envtest binaries for Kubernetes version $( ENVTEST_K8S_VERSION) … "
235252 @$(ENVTEST ) use $(ENVTEST_K8S_VERSION ) --bin-dir $(LOCALBIN ) -p path || { \
236253 echo " Error: Failed to set up envtest binaries for version $( ENVTEST_K8S_VERSION) ." ; \
237254 exit 1; \
@@ -257,28 +274,8 @@ code-generator: $(CODE_GENERATOR) ## Download code-generator locally if necessar
257274$(CODE_GENERATOR ) : $(LOCALBIN )
258275 $(call go-install-tool,$(CODE_GENERATOR ) ,k8s.io/code-generator,$(CODE_GENERATOR_VERSION ) )
259276
260- KIND_CLUSTER ?= fluent-operator-test-e2e
261-
262- .PHONY : setup-test-e2e
263- setup-test-e2e : # # Set up a Kind cluster for e2e tests if it does not exist
264- @command -v $(KIND ) > /dev/null 2>&1 || { \
265- echo " Kind is not installed. Please install Kind manually." ; \
266- exit 1; \
267- }
268- @case " $$ ($( KIND) get clusters)" in \
269- * " $( KIND_CLUSTER) " * ) \
270- echo " Kind cluster '$( KIND_CLUSTER) ' already exists. Skipping creation." ;; \
271- * ) \
272- echo " Creating Kind cluster '$( KIND_CLUSTER) '..." ; \
273- $(KIND ) create cluster --name $(KIND_CLUSTER ) ;; \
274- esac
275-
276- .PHONY : cleanup-test-e2e
277- cleanup-test-e2e :
278- $(KIND ) delete cluster --name $(KIND_CLUSTER )
279-
280277.PHONY : kind
281- kind : $(KIND ) # # Download code-generator locally if necessary.
278+ kind : $(KIND ) # # Install kind locally if necessary.
282279$(KIND ) : $(LOCALBIN )
283280 $(call go-install-tool,$(KIND ) ,sigs.k8s.io/kind,$(KIND_VERSION ) )
284281
@@ -376,12 +373,6 @@ go-deps: # download go dependencies
376373docs-update : # update api docs
377374 go run ./cmd/doc-gen/main.go
378375
379- e2e : ginkgo # make e2e tests
380- tests/scripts/fluentd_e2e.sh
381-
382- helm-e2e : ginkgo # make helm e2e tests
383- tests/scripts/fluentd_helm_e2e.sh
384-
385376update-helm-package : # update helm repo
386377 ./hack/update-helm-package.sh
387378
0 commit comments