Skip to content

fix: Enable goleak for cli tests #3370

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 6 commits into from
Aug 12, 2022
Merged

fix: Enable goleak for cli tests #3370

merged 6 commits into from
Aug 12, 2022

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Aug 3, 2022

This PR enables goleak checking for cli commands. This should be worhwile to detect potential leaks caused by long-running commands like coder server, maybe others.

Merging is currently blocked until these PRs are merged (or we switch to forks):

Closes #3221

@mafredri mafredri self-assigned this Aug 3, 2022
mafredri added a commit that referenced this pull request Aug 10, 2022
goleak.VerifyTestMain(m,
// The lumberjack library is used by by agent and seems to leave
// goroutines after Close(), fails TestGitSSH tests.
// https://github.com/natefinch/lumberjack/pull/100
Copy link
Member

Choose a reason for hiding this comment

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

Should we do a go mod replace instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

TBH I haven't done a proper review of that PR, and I'm not confident in using it in a production environment without doing so. My judgement was that this is a non-issue in a production environment since the agent only runs once and thus won't be leaking memory, so I think the goleak ignore is acceptable here.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense! TY sir

@mafredri mafredri marked this pull request as ready for review August 12, 2022 17:34
@mafredri mafredri merged commit 010f64e into main Aug 12, 2022
@mafredri mafredri deleted the mafredri/enable-cli-goleak branch August 12, 2022 18:02
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.

Fix issues reported by goleak in cli package tests and then enable goleak
2 participants