Skip to content

Wait for the monitor loop to exit in TestMonitor_SpotDetectionDoesNotGateTicker - #1102

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/monitor-test-leak
Oct 18, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/monitor-test-leak

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Windows CI failed TestScrapeTakesNoSample on #1099 (a CHANGELOG-only PR; main is green): readers took 4 counter samples; only the monitor loop may sample (#952).

TestMonitor_SpotDetectionDoesNotGateTicker runs go a.Monitor(ctx) on a 10ms ticker and only defer cancel()s; it never waits for Monitor to return. A tick still in progress when the test ends samples through the package-level counter stubs, which by then belong to the next test. On Windows each tick shells out (quser, PowerShell), so it lasts long enough to overlap.

The test now cancels and waits for Monitor to return in a cleanup, failing if it does not within 10s. Not reproducible on demand locally (30 back-to-back runs pass either way on macOS): fixed by the mechanism.

@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 1a6f9ce into main Oct 18, 2026
8 checks passed
@scttfrdmn
scttfrdmn deleted the fix/monitor-test-leak branch October 18, 2026 00:36
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