Optimize make test-unit for sub-30s feedback via impacted-first execution - #47200
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot update agents.md and agent instructions |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated both |
🤖 PR Triage
Changes
|
| - Standard frontmatter defaults | ||
| - Frontmatter ordering/style conventions | ||
| - Security or policy constraints specific to this repository | ||
| - For agent validation guidance, treat `make test-unit` as impacted-first (~30s target); use `TEST_UNIT_RUN_FULL=1 make test-unit` or `make test-unit-all` when you need full Go unit-suite coverage. |
There was a problem hiding this comment.
Done in commit 2a8c00a.
There was a problem hiding this comment.
Pull request overview
Changes unit-test validation to prioritize impacted Go tests within a configurable time budget.
Changes:
- Adds impacted-first and full-suite test modes.
- Adds deterministic sampled fallback behavior.
- Updates agent guidance and Make help text.
Show a summary per file
| File | Description |
|---|---|
Makefile |
Implements impacted-first testing, sampling, and full-suite targets. |
AGENTS.md |
Documents the revised validation workflow. |
.github/aw/instructions.md |
Adds repository-specific test guidance. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 4
- Review effort level: Medium
| test-unit: | ||
| go test -v -parallel=4 -timeout=10m -run='^Test' ./... -short | ||
| @echo "Running impacted Go unit tests first (time budget: $(TEST_UNIT_MAX_SECONDS)s)..."; \ | ||
| $(MAKE) --no-print-directory test-impacted-go CI_COVERAGE_ENABLED=0 GO_IMPACTED_TEST_MAX_SECONDS=$(TEST_UNIT_MAX_SECONDS) GO_IMPACTED_TEST_FALLBACK_MODE=$(TEST_UNIT_IMPACTED_FALLBACK_MODE) GO_IMPACTED_TEST_SAMPLE_PER_PACKAGE=$(GO_IMPACTED_TEST_SAMPLE_PER_PACKAGE); \ |
| test-unit: | ||
| go test -v -parallel=4 -timeout=10m -run='^Test' ./... -short | ||
| @echo "Running impacted Go unit tests first (time budget: $(TEST_UNIT_MAX_SECONDS)s)..."; \ | ||
| $(MAKE) --no-print-directory test-impacted-go CI_COVERAGE_ENABLED=0 GO_IMPACTED_TEST_MAX_SECONDS=$(TEST_UNIT_MAX_SECONDS) GO_IMPACTED_TEST_FALLBACK_MODE=$(TEST_UNIT_IMPACTED_FALLBACK_MODE) GO_IMPACTED_TEST_SAMPLE_PER_PACKAGE=$(GO_IMPACTED_TEST_SAMPLE_PER_PACKAGE); \ |
| echo "No impacted timing data available; running up to $$SAMPLE_PER_PACKAGE sampled top-level tests per impacted package."; \ | ||
| printf '%s\n' "$$CHANGED_GO_PACKAGES" | while IFS= read -r pkg; do \ | ||
| [ -z "$$pkg" ] && continue; \ | ||
| TEST_PATTERN=$$(go test -list '^Test' "$$pkg" 2>/dev/null | head -n "$$SAMPLE_PER_PACKAGE" | paste -sd'|' -); \ |
| @echo " test-unit - Run impacted Go unit tests first (~$(TEST_UNIT_MAX_SECONDS)s budget); set TEST_UNIT_RUN_FULL=1 for full suite" | ||
| @echo " test-unit-all - Run full Go unit test suite" |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |
make test-unitcurrently runs the full Go unit suite, which is too slow for iteration. This update shifts the default path to impacted-first execution with a ~30s budget target, while preserving an explicit full-suite option.Default
test-unitbehavior: impacted-first, budget-orientedtest-unitnow delegates totest-impacted-gowith:GO_IMPACTED_TEST_MAX_SECONDS=$(TEST_UNIT_MAX_SECONDS)(default 30s)CI_COVERAGE_ENABLED=0)TEST_UNIT_MAX_SECONDSandTEST_UNIT_IMPACTED_FALLBACK_MODEknobs.Deterministic fallback when timing artifacts are unavailable
test-impacted-gowith fallback modesample:GO_IMPACTED_TEST_SAMPLE_PER_PACKAGEtop-level tests per impacted packagetest-unitpathGO_IMPACTED_TEST_SAMPLE_PER_PACKAGE_DEFAULT.Explicit full-suite path preserved
test-unit-allfor full Go unit coverage (go test ./... -short).test-unitcan append full coverage viaTEST_UNIT_RUN_FULL=1.testcontinues to runtest-unit+test-integration(now benefits from impacted-first unit pass).Developer UX updates