Skip to content

Commit 3398e48

Browse files
[Monorepo] Combine Unit Tests
- Updated the root `Makefile` with a unified `test-unit` target to execute unit tests for the entire project. - Removed the `test-unit` target from the `Makefile` under the `catalogd` directory as it is no longer needed.
1 parent dc6f9e5 commit 3398e48

File tree

3 files changed

+2
-46
lines changed

3 files changed

+2
-46
lines changed

.github/workflows/catalogd-unit.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ verify-crd-compatibility: $(CRD_DIFF) manifests
147147
$(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml" ${CRD_DIFF_UPDATED_SOURCE}
148148

149149
.PHONY: test
150-
test: manifests generate fmt vet test-unit test-e2e #HELP Run all tests.
150+
test: manifests generate generate-catalogd fmt vet test-unit test-e2e #HELP Run all tests.
151151

152152
.PHONY: e2e
153153
e2e: #EXHELP Run the e2e tests.
@@ -168,7 +168,7 @@ test-ext-dev-e2e: $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run extension creat
168168
go test -count=1 -v ./test/extension-developer-e2e/...
169169

170170
ENVTEST_VERSION := $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.x/')
171-
UNIT_TEST_DIRS := $(shell go list ./... | grep -v /test/)
171+
UNIT_TEST_DIRS := $(shell go list ./... | grep -v /test/ | grep -v /catalogd/test/)
172172
COVERAGE_UNIT_DIR := $(ROOT_DIR)/coverage/unit
173173

174174
.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.

catalogd/Makefile

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ export IMAGE_TAG
1515

1616
IMAGE := $(IMAGE_REPO):$(IMAGE_TAG)
1717

18-
# By default setup-envtest will write to $XDG_DATA_HOME, or $HOME/.local/share if that is not defined.
19-
# If $HOME is not set, we need to specify a binary directory to prevent an error in setup-envtest.
20-
# Useful for some CI/CD environments that set neither $XDG_DATA_HOME nor $HOME.
21-
SETUP_ENVTEST_BIN_DIR_OVERRIDE=
22-
ifeq ($(shell [[ $$HOME == "" || $$HOME == "/" ]] && [[ $$XDG_DATA_HOME == "" ]] && echo true ), true)
23-
SETUP_ENVTEST_BIN_DIR_OVERRIDE += --bin-dir /tmp/envtest-binaries
24-
endif
25-
2618
ifneq (, $(shell command -v docker 2>/dev/null))
2719
CONTAINER_RUNTIME := docker
2820
else ifneq (, $(shell command -v podman 2>/dev/null))
@@ -87,14 +79,6 @@ bingo-upgrade: $(BINGO) #EXHELP Upgrade tools
8779
$(BINGO) get "$$pkg@latest"; \
8880
done
8981

90-
.PHONY: test-unit
91-
UNIT_TEST_DIRS := $(shell go list ./... | grep -v /test/e2e | grep -v /test/upgrade)
92-
test-unit: generate fmt vet $(SETUP_ENVTEST) ## Run tests.
93-
eval $$($(SETUP_ENVTEST) use -p env $(ENVTEST_SERVER_VERSION) $(SETUP_ENVTEST_BIN_DIR_OVERRIDE)) && \
94-
go test \
95-
-tags '$(GO_BUILD_TAGS)' \
96-
-coverprofile cover.out \
97-
$(UNIT_TEST_DIRS)
9882

9983
FOCUS := $(if $(TEST),-v -focus "$(TEST)")
10084
ifeq ($(origin E2E_FLAGS), undefined)

0 commit comments

Comments
 (0)