fix(logging): de-flake TestSafeGo_IncrementsCounter#3606
Merged
Conversation
Add component filter (want field) and idempotent close (sync.Once) to stubCounter so a leaked goroutine from TestSafeGo_RecoversFromPanic cannot corrupt the stub used by TestSafeGo_IncrementsCounter.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
alekspetrov
added a commit
that referenced
this pull request
Jun 15, 2026
… TASK-365 (#3608) - README Current State: lead with v2.186.9 (TASK-357 Wave 4 closes the TASK-322 audit via #3603; flaky-test de-flake shipped by Pilot via #3606), soften the v2.186.8 restart note to past tense, collapse the archived v2.186.0/.1 bullets to keep the block lean. - Archive TASK-365 (de-flake task doc) — shipped in v2.186.9.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
want stringfield tostubCounter;Increturns early ifcomponent != s.want, dropping the leaked call fromTestSafeGo_RecoversFromPanic(which uses"test-component") before it can touch the stub inTestSafeGo_IncrementsCounter(which expects"counter-test").close(s.done)insync.Onceso any stray matching call cannot double-close the channel.safego.gois unchanged — production behavior is unaffected.Fixes #3605
Test plan
go build ./...— cleango vet ./internal/logging/...— cleango test ./internal/logging/ -run TestSafeGo -count=200 -race— 200 passes, no failuresgo test ./internal/logging/...— cleangolangci-lint run --new-from-rev=origin/main ./internal/logging/...— 0 issues