-
Notifications
You must be signed in to change notification settings - Fork 74
fix(ci): run validators/ unit tests in make test, exclude from covergae gate #1918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9504036
a2edf95
08af4e5
94c82ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -220,13 +220,17 @@ license-check: ## Check license is approved | |
| test-shell: ## Runs shell unit tests (tools/*_test.sh; hermetic, no cluster) | ||
| @set -e; for t in tools/*_test.sh; do [ -e "$$t" ] || continue; echo "Running $$t..."; bash "$$t"; done | ||
|
|
||
| # validators/ tests run as part of `make test` but are excluded from the | ||
| # coverage.out this target emits: per-package coverage there runs 41-92% | ||
| # (see #1752), which would pull the project-wide gate from ~80% to ~75.8%. | ||
| .PHONY: test | ||
| test: test-shell ## Runs unit tests with race detector and coverage (use -short to skip integration tests) | ||
| @set -e; \ | ||
| echo "Running tests with race detector..."; \ | ||
| KUBEBUILDER_ASSETS=$$(setup-envtest use -p path 2>/dev/null || echo "") \ | ||
| AICR_CRITERIA_STRICT=1 \ | ||
| GOFLAGS="-mod=vendor" go test -short -count=1 -race -timeout=$(TEST_TIMEOUT) -covermode=atomic -coverprofile=coverage.out $$(go list ./... | grep -v -e /tests/chainsaw/ -e /validators) || exit 1; \ | ||
| GOFLAGS="-mod=vendor" go test -short -count=1 -race -timeout=$(TEST_TIMEOUT) -covermode=atomic -coverprofile=coverage.full.out $$(go list ./... | grep -v -e /tests/chainsaw/) || exit 1; \ | ||
| grep -v '^github.com/NVIDIA/aicr/validators/' coverage.full.out > coverage.out; \ | ||
| echo "Test coverage:"; \ | ||
| go tool cover -func=coverage.out | tail -1 | ||
|
coderabbitai[bot] marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Minor — Two divergent coverage numbers for the same commit; decide deliberately which one is published This line still prints the unfiltered total, so a single Blast radius: Contributor confusion locally, plus a ~4.4pt drop in the publicly reported coverage badge on main that reflects no real regression. Fix: Filter once at profile-production time (see the blocker) so this line, the gate, the badge, and the delta report all agree. If the filter must stay in |
||
|
|
||
|
|
@@ -656,7 +660,7 @@ changelog-file: ## Updates CHANGELOG.md with changes since the last release | |
|
|
||
| .PHONY: clean | ||
| clean: ## Cleans build artifacts (dist, coverage files, third-party notices) | ||
| @rm -rf ./dist ./bin ./coverage.out ./THIRD_PARTY_NOTICES.md ./.licenses-cache | ||
| @rm -rf ./dist ./bin ./coverage.out ./coverage.full.out ./THIRD_PARTY_NOTICES.md ./.licenses-cache | ||
| @go clean ./... | ||
| @echo "Cleaned build artifacts" | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Nitpick — New
coverage.full.outisn't cleaned or ignoredmake clean(line 650) removes./coverage.outbut not the newly-introducedcoverage.full.out, and.gitignorecovers neither.Blast radius: A run leaves an untracked artifact in the working tree.
Fix: Add
coverage.full.outto thecleantarget'srmlist (and optionally to.gitignore).