Skip to content

Commit 45f0b56

Browse files
committed
refactor some methods comments, name and unit testing
1 parent 7abc7db commit 45f0b56

9 files changed

+143
-1048
lines changed

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ endif
7171
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
7272
# SHELL = /usr/bin/env bash -o pipefail
7373
.SHELLFLAGS = -ec
74-
7574
# Quiet Ginkgo for now.
7675
# The warnings are in regards to a future release.
7776
export ACK_GINKGO_DEPRECATIONS := 1.16.5
@@ -250,14 +249,21 @@ cluster-api/tilt-settings.json: hack/tilt-settings.json cluster-api
250249
## --------------------------------------
251250
export KUBEBUILDER_ASSETS=$(REPO_ROOT)/$(TOOLS_BIN_DIR)
252251
DEEPCOPY_GEN_TARGETS_TEST=$(shell find test/fakes -type d -name "fakes" -exec echo {}\/zz_generated.deepcopy.go \;)
253-
DEEPCOPY_GEN_INPUTS_TEST=$(shell find test/fakes/* -name "*_types.go" -name "*zz_generated*" -prune -o -type f -print)
252+
DEEPCOPY_GEN_INPUTS_TEST=$(shell find test/fakes/* -name "*zz_generated*" -prune -o -type f -print)
254253
.PHONY: generate-deepcopy-test
255254
generate-deepcopy-test: $(DEEPCOPY_GEN_TARGETS_TEST) ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
256255
test/fakes/zz_generated.deepcopy.go: $(CONTROLLER_GEN) $(DEEPCOPY_GEN_INPUTS_TEST)
257256
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
258257

258+
MANIFEST_GEN_INPUTS_TEST=$(shell find test/fakes/* -name "*zz_generated*" -prune -o -type f -print)
259+
.PHONY: generate-manifest-test
260+
generate-manifest-test: config/.flag-test.mk ## Generates crd, webhook, rbac, and other configuration manifests from kubebuilder instructions in go comments.
261+
config/.flag-test.mk: $(CONTROLLER_GEN) $(MANIFEST_GEN_INPUTS_TEST)
262+
$(CONTROLLER_GEN) crd:crdVersions=v1 rbac:roleName=manager-role webhook paths="./test/fakes" output:crd:artifacts:config=test/fakes
263+
@touch config/.flag-test.mk
264+
259265
.PHONY: test
260-
test: generate-deepcopy-test generate-mocks lint $(GINKGO_V2) $(KUBECTL) $(API_SERVER) $(ETCD) ## Run tests. At the moment this is only unit tests.
266+
test: generate-deepcopy-test generate-manifest-test generate-mocks lint $(GINKGO_V2) $(KUBECTL) $(API_SERVER) $(ETCD) ## Run tests. At the moment this is only unit tests.
261267
@./hack/testing_ginkgo_recover_statements.sh --add # Add ginkgo.GinkgoRecover() statements to controllers.
262268
@# The following is a slightly funky way to make sure the ginkgo statements are removed regardless the test results.
263269
@$(GINKGO_V2) --label-filter="!integ" --cover -coverprofile cover.out --covermode=atomic -v ./api/... ./controllers/... ./pkg/...; EXIT_STATUS=$$?;\

0 commit comments

Comments
 (0)