Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

The test coverage check was using grep to find test functions, which doesn't respect Go build tags. This caused baseline mismatches between discovered tests (3986) and actually runnable tests in CI.

Changes

  • Replace grep-based test discovery with go test -list

    • Respects build tags (-tags '!integration' for unit tests, -tags 'integration' for integration tests)
    • Discovers tests the same way Go's test runner does
    • Returns only executable test functions (3431 unit + 581 integration = 3986 unique)
  • Filter test output correctly

    • Use grep '^Test[A-Z]' to match actual test functions
    • Excludes non-test output like "Test: Using compiler version: ..." from build diagnostics

Before:

find . -name "*_test.go" -type f -exec grep -h "^func Test" {} \; | \
  sed 's/func \(Test[^(]*\).*/\1/' | grep -v "^TestMain$" | sort -u

After:

go test -list='^Test' -tags '!integration' ./... 2>/dev/null | grep '^Test[A-Z]' | grep -v '^TestMain$' > "$unit_tests"
go test -list='^Test' -tags 'integration' ./... 2>/dev/null | grep '^Test[A-Z]' | grep -v '^TestMain$' > "$integration_tests"
cat "$unit_tests" "$integration_tests" | sort -u
Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/21501128756/job/61947580275#step:7:1

Fix test run


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 30, 2026 01:42
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues in test run Fix test coverage check to use go test -list instead of grep Jan 30, 2026
Copilot AI requested a review from pelikhan January 30, 2026 01:48
@pelikhan pelikhan marked this pull request as ready for review January 30, 2026 02:00
@pelikhan pelikhan merged commit a8b0e42 into copilot/compute-frontmatter-hash Jan 30, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/fix-test-run branch January 30, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants