Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: fix TestCache_DeploymentStats flake#19683

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 5 commits intomainfromethan/deployment-stats-flake
Sep 8, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndicksonethanndickson commentedSep 3, 2025
edited
Loading

Closescoder/internal#961
Likely the same deal as in#19599, the body ofrequire.Eventually now fires immediately, when it used to fire after 250ms (the interval). Presumably, the deployment stats become ready before the vs code session count gets incremented. This was never an issue with the 250ms delay, as this flake has only cropped up after the testify version bump.

We'll fix the issue by making it possible to wait for a full metrics cache refresh, i.e. removingrequire.Eventually in this test altogether.

@ethanndicksonGraphite App
Copy link
MemberAuthor

This stack of pull requests is managed byGraphite. Learn more aboutstacking.

@ethanndicksonethanndickson marked this pull request as ready for reviewSeptember 3, 2025 05:49
@spikecurtis
Copy link
Contributor

Can we stop usingEventually entirely? Like, make this test actually deterministic?

ethanndickson reacted with eyes emoji

@ethanndickson
Copy link
MemberAuthor

ethanndickson commentedSep 3, 2025
edited
Loading

Can we stop usingEventually entirely? Like, make this test actually deterministic?

@spikecurtis I've gone with an approach similar to that used bydbpurge_test, though I had to change the way the ticking works slightly. This seems preferable to modifying the API of the metrics cache.

If this approach looks good to you, I'll update the other tests to also no longer userequire.Eventually.

EDIT: An unrelated test is failing because it callsclock.Set with a time after the nextmetricscache tick time (which quartz does not allow).
If we want to go with this solution, we may need to stop piping the clock fromcoderdtest.Options through tometricscache, and just always give it a real clock when created as part of acoderdtest.
Alternatively, those tests that need to set the clock to a time in the future could just choose really long tick intervals.
WDYT?

@spikecurtisGraphite App
Copy link
Contributor

In general,clock.Set is discouraged other than start of testbefore you pass it to anything.

Also, Quartz mocks are not really designed for integration tests where you have a whole lot of things calling into the clock with different intervals.

@ethanndicksonethanndicksonforce-pushed theethan/deployment-stats-flake branch from1c19d4f to3093efdCompareSeptember 4, 2025 06:47
Copy link
Contributor

@spikecurtisspikecurtis left a comment

Choose a reason for hiding this comment

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

Suggestion inline about only triggering a single tick and using Advance rather than AdvanceNext, but I don't need to review again. Nice work.

@ethanndickson
Copy link
MemberAuthor

~/coder [main] » go test github.com/coder/coder/v2/coderd/metricscache -count=1ok      github.com/coder/coder/v2/coderd/metricscache   5.099s~/coder [ethan/deployment-stats-flake] » go test github.com/coder/coder/v2/coderd/metricscache -count=1ok      github.com/coder/coder/v2/coderd/metricscache   0.118s

🎉

@ethanndicksonethanndickson merged commitdae1903 intomainSep 8, 2025
27 checks passed
@ethanndicksonethanndickson deleted the ethan/deployment-stats-flake branchSeptember 8, 2025 02:07
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 8, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@spikecurtisspikecurtisspikecurtis approved these changes

@johnstcnjohnstcnAwaiting requested review from johnstcn

Assignees

@ethanndicksonethanndickson

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

flake: TestCache_DeploymentStats

2 participants

@ethanndickson@spikecurtis

[8]ページ先頭

©2009-2025 Movatter.jp