Skip to content

test(app): stop running the log-capturing tests in parallel - #518

Merged
fclairamb merged 2 commits into
mainfrom
fix/capture-logs-race
Oct 11, 2026
Merged

fclairamb merged 2 commits into
mainfrom
fix/capture-logs-race

Conversation

@fclairamb

Copy link
Copy Markdown
Owner

captureLogs swaps the process-wide slog default, but the three t.Parallel() tests that call it raced with every other parallel test in internal/app: other tests' lines landed in their buffer (TestLogMetricsScrapeTokenState even asserts its buffer is empty), and their own line could land in another caller's buffer. TestMetricsRouteDBTokenTakesEffectAndLabelsIntact failed exactly that way on #517's CI (its buffer held only other tests' logs, not "metrics endpoint requires a bearer scrape token").

The three tests now run serially (nolint:paralleltest), which in Go means before the parallel tests are released, and captureLogs documents why its callers must not be parallel. Passes 5/5 in separate processes locally.

🤖 Generated with Claude Code

captureLogs swaps the process-wide slog default. The three t.Parallel()
tests calling it raced with every other parallel test in the package:
other tests' lines landed in their buffer (TestLogMetricsScrapeTokenState
asserts it is EMPTY) and their own line could land in another caller's.
TestMetricsRouteDBTokenTakesEffectAndLabelsIntact failed that way in CI
on 2026-10-11 (its buffer held only other tests' logs). They now run
serially, before the parallel tests are released, and captureLogs says
why its callers must not be parallel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fclairamb
fclairamb enabled auto-merge (squash) October 11, 2026 10:57
@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.71%. Comparing base (84dc69d) to head (f20c088).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #518      +/-   ##
==========================================
- Coverage   82.75%   82.71%   -0.05%     
==========================================
  Files        1175     1175              
  Lines      121450   121450              
==========================================
- Hits       100508   100454      -54     
- Misses      20935    20989      +54     
  Partials        7        7              

see 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fclairamb
fclairamb merged commit fb55f25 into main Oct 11, 2026
26 checks passed
@fclairamb
fclairamb deleted the fix/capture-logs-race branch October 11, 2026 11:15
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.

1 participant