|
58 | 58 | # bingo manages consistent tooling versions for things like kind, etc. |
59 | 59 | include .bingo/Variables.mk |
60 | 60 |
|
| 61 | +# mockgen is installed by bingo with a versioned name (mockgen-v0.6.0). |
| 62 | +# Redefine MOCKGEN to an unversioned symlink so that go generate can find it on PATH. |
| 63 | +_MOCKGEN_BINGO := $(MOCKGEN) |
| 64 | +MOCKGEN := $(ROOT_DIR)/bin/mockgen |
| 65 | +$(MOCKGEN): $(_MOCKGEN_BINGO) |
| 66 | + @mkdir -p $(dir $@) |
| 67 | + @ln -sf $< $@ |
| 68 | + |
61 | 69 | ifeq ($(origin KIND_CLUSTER_NAME), undefined) |
62 | 70 | KIND_CLUSTER_NAME := operator-controller |
63 | 71 | endif |
@@ -201,8 +209,12 @@ manifests: update-crds $(MANIFESTS) $(HELM) #EXHELP Generate OLMv1 manifests |
201 | 209 | $(HELM) template olmv1 helm/olmv1 --values helm/tilt.yaml $(addprefix --set ,$(HELM_SETTINGS)) > /dev/null |
202 | 210 | $(HELM) template olmv1 helm/olmv1 --set "options.openshift.enabled=true" > /dev/null |
203 | 211 |
|
| 212 | +.PHONY: generate-mocks |
| 213 | +generate-mocks: $(MOCKGEN) #EXHELP Generate mock implementations for testing. |
| 214 | + PATH="$(ROOT_DIR)/bin:$$PATH" go generate ./... |
| 215 | + |
204 | 216 | .PHONY: generate |
205 | | -generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, DeepCopyObject, and ApplyConfiguration type implementations. |
| 217 | +generate: $(CONTROLLER_GEN) generate-mocks #EXHELP Generate code containing DeepCopy, DeepCopyInto, DeepCopyObject, and ApplyConfiguration type implementations. |
206 | 218 | # Need to delete the files for them to be generated properly |
207 | 219 | @find api cmd hack internal -name "zz_generated.deepcopy.go" -not -path "*/vendor/*" -delete && rm -rf applyconfigurations |
208 | 220 | $(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) applyconfiguration:headerFile="hack/boilerplate.go.txt" paths="./api/..." |
@@ -289,7 +301,7 @@ extension-developer-e2e: export CONTAINER_RUNTIME := $(CONTAINER_RUNTIME) |
289 | 301 | extension-developer-e2e: $(OPERATOR_SDK) #EXHELP Run extension create, upgrade and delete tests. |
290 | 302 | go test -count=1 -v ./test/extension-developer-e2e/... |
291 | 303 |
|
292 | | -UNIT_TEST_DIRS := $(shell go list ./... | grep -vE "/test/|/testutils") $(shell go list ./test/internal/...) |
| 304 | +UNIT_TEST_DIRS := $(shell go list ./... | grep -vE "/test/|/testutils|/testutil/mock") $(shell go list ./test/internal/...) |
293 | 305 | COVERAGE_UNIT_DIR := $(ROOT_DIR)/coverage/unit |
294 | 306 |
|
295 | 307 | .PHONY: envtest-k8s-bins #HELP Uses setup-envtest to download and install the binaries required to run ENVTEST-test based locally at the project/bin directory. |
|
0 commit comments