Skip to content

fix: stop checking gauges unrelated to TestAgent_Stats_Magic #17290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025

Conversation

spikecurtis
Copy link
Contributor

@spikecurtis spikecurtis commented Apr 8, 2025

Fixes coder/internal#564

The test is asserting too much, including stats guages that are not directly related to the thing we are trying to test: ConnectionCount, RxBytes, and TxBytes. I think the author assumed that these are counts that only go up, but they are guages and eventually zero back out, so there are race condtions where not all of them are non-zero at the same time.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@spikecurtis spikecurtis requested a review from johnstcn April 8, 2025 12:54
@spikecurtis spikecurtis marked this pull request as ready for review April 8, 2025 12:54
@@ -190,7 +190,7 @@ func TestAgent_Stats_Magic(t *testing.T) {
s, ok := <-stats
t.Logf("got stats: ok=%t, ConnectionCount=%d, RxBytes=%d, TxBytes=%d, SessionCountVSCode=%d, ConnectionMedianLatencyMS=%f",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably also remove these fields (ConnectionCount, RxBytes, TxBytes) from the t.Logf as well as they're not relevant to this test. If we need to introspect in more detail, a debugger is probably a better option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree --- although we shouldn't be asserting their values, it can be useful to see them in logs so you can tell the difference between a test that misclassifies the VSCode session from one where we fail to connect at all, or fail to get any meaningful stats.

The debugger is great, but relatively useless for diagnosing rare-ish flakes.

@spikecurtis spikecurtis merged commit b1f59aa into main Apr 8, 2025
40 of 41 checks passed
@spikecurtis spikecurtis deleted the spike/fix-TestAgent_Stats_Magic branch April 8, 2025 13:01
@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake: TestAgent_Stats_Magic
2 participants