Skip to content

chore(cli): refactor TestServer/Prometheus to use testutil.Eventually #17295

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

johnstcn
Copy link
Member

@johnstcn johnstcn commented Apr 8, 2025

Updates coder/internal#282

Refactors existing tests to use testutil.Eventually which plays nicer with testutil.Context.

@johnstcn johnstcn self-assigned this Apr 8, 2025
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

I don't mind the switch to testutil, but we should fix the underlying cause for these flakes (the random port that gets reallocated by other tests).

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort)
defer cancel()

ctx := testutil.Context(t, testutil.WaitLong)
randPort := testutil.RandomPort(t)
Copy link
Member

Choose a reason for hiding this comment

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

In my experience, this is a huge culprit for this test flaking. But fixing it is tricky, we'd have to 1) start a listener and hand it over to the cmd, or 2) use :0 but somehow signal the test what port to access.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah agreed -- follow-up

@johnstcn johnstcn merged commit 389e88e into main Apr 8, 2025
36 checks passed
@johnstcn johnstcn deleted the cj/flake/TestServer/Prometheus/DBMetricsEnabled branch April 8, 2025 15:53
@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.

2 participants