Skip to content

test: fix TestAll flakiness on Go 1.26 - #154

Merged
moisesvega merged 1 commit into
masterfrom
justinhwang/fix-testall-flaky
Aug 27, 2026
Merged

moisesvega merged 1 commit into
masterfrom
justinhwang/fix-testall-flaky

Conversation

@justinhwang

Copy link
Copy Markdown
Contributor

TestAll sorted goroutines by ID and assumed the sorted order mapped to creation order (main, test goroutine, then the 5 workers). As of Go 1.26 goroutine IDs are no longer handed out in strict creation order, so a worker could sort ahead of the test goroutine and the positional assertions failed. Identify goroutines by their stack contents instead.

Also join the worker goroutines before returning. They were previously leaked; under 'go test -race -count=N' a leftover worker from one iteration raced the next iteration's reassignment of the _allDone global. waitForDone stays argument-free (so it still exercises parsing of a no-arg frame) by signalling completion through a package-level WaitGroup.

TestAll sorted goroutines by ID and assumed the sorted order mapped to creation order (main, test goroutine, then the 5 workers). As of Go 1.26 goroutine IDs are no longer handed out in strict creation order, so a worker could sort ahead of the test goroutine and the positional assertions failed. Identify goroutines by their stack contents instead.

Also join the worker goroutines before returning. They were previously leaked; under 'go test -race -count=N' a leftover worker from one iteration raced the next iteration's reassignment of the _allDone global. waitForDone stays argument-free (so it still exercises parsing of a no-arg frame) by signalling completion through a package-level WaitGroup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.24%. Comparing base (5f791e3) to head (f5925cc).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #154   +/-   ##
=======================================
  Coverage   99.24%   99.24%           
=======================================
  Files           5        5           
  Lines         264      264           
=======================================
  Hits          262      262           
  Misses          1        1           
  Partials        1        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@moisesvega
moisesvega merged commit ec968c3 into master Aug 27, 2026
6 checks passed
@moisesvega
moisesvega deleted the justinhwang/fix-testall-flaky branch August 27, 2026 18:08
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