Skip to content

Commit 419c011

Browse files
test(pod-health): add comprehensive unit tests for pod health monitoring
Add 703 lines of unit tests covering pod failure analysis, container status detection, ConfigMap error extraction, and failure message building. Tests verify all failure types (scheduling, init, crash, image pull, config errors) and message prioritization logic. Also exclude generated code and test utils from coverage reports via .codacy.yml and Makefile filtering.
1 parent 4134a2a commit 419c011

File tree

3 files changed

+709
-1
lines changed

3 files changed

+709
-1
lines changed

.codacy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
exclude_paths:
2+
- "**/zz_generated.deepcopy.go"
3+
- "test/utils/**"

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ tidy: ## Run go mod tidy
114114

115115
.PHONY: test
116116
test: manifests generate fmt vet setup-envtest generate-test-crds ## Run tests.
117-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
117+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out.tmp
118+
@grep -v -E '(zz_generated|test/utils)' cover.out.tmp > cover.out
119+
@rm -f cover.out.tmp
118120

119121
.PHONY: generate-test-crds
120122
generate-test-crds: kustomize manifests ## Generate v1-only CRD for integration tests (no conversion webhook needed).

0 commit comments

Comments
 (0)