Skip to content

fix(logging): de-flake TestSafeGo_IncrementsCounter#3606

Merged
alekspetrov merged 1 commit into
mainfrom
pilot/GH-3605
Jun 15, 2026
Merged

fix(logging): de-flake TestSafeGo_IncrementsCounter#3606
alekspetrov merged 1 commit into
mainfrom
pilot/GH-3605

Conversation

@alekspetrov

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a want string field to stubCounter; Inc returns early if component != s.want, dropping the leaked call from TestSafeGo_RecoversFromPanic (which uses "test-component") before it can touch the stub in TestSafeGo_IncrementsCounter (which expects "counter-test").
  • Wraps close(s.done) in sync.Once so any stray matching call cannot double-close the channel.
  • safego.go is unchanged — production behavior is unaffected.

Fixes #3605

Test plan

  • go build ./... — clean
  • go vet ./internal/logging/... — clean
  • go test ./internal/logging/ -run TestSafeGo -count=200 -race — 200 passes, no failures
  • go test ./internal/logging/... — clean
  • golangci-lint run --new-from-rev=origin/main ./internal/logging/... — 0 issues

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-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@alekspetrov alekspetrov merged commit 5124359 into main Jun 15, 2026
3 checks passed
@alekspetrov alekspetrov deleted the pilot/GH-3605 branch June 15, 2026 18:28
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.
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.

fix(logging): de-flake TestSafeGo_IncrementsCounter — leaked sibling goroutine corrupts the stub

2 participants