-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[mdatagen] generate goleak package test #9959
[mdatagen] generate goleak package test #9959
Conversation
There's an open issue in the contrib repository for this with some discussion. Might be good to add a reference in the PR description, or copy/move it to core? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this, automatically generating the tests will be really helpful 👍
@@ -66,6 +66,10 @@ func run(ymlPath string) error { | |||
filepath.Join(ymlDir, "generated_component_test.go"), md, packageName); err != nil { | |||
return err | |||
} | |||
if err = generateFile(filepath.Join(tmplDir, "package_test.go.tmpl"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very familiar with the inner-workings of mdatagen
, but would it be very hard to modify so that sub-packages also have goleak
generated?
For example:
.//consumer/consumertest/package_test.go
.//consumer/consumererror/package_test.go
.//consumer/package_test.go
One of the potential challenges of this is that each subdir/package would need its own goleak options, as it may need skipped, or have its own ignores that we don't want in other packages.
It's likely out of the scope of this PR, just raising as something that could be done here, or will need to be done later.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9959 +/- ##
==========================================
- Coverage 91.70% 91.69% -0.02%
==========================================
Files 358 358
Lines 16543 16546 +3
==========================================
+ Hits 15171 15172 +1
- Misses 1045 1046 +1
- Partials 327 328 +1 ☔ View full report in Codecov by Sentry. |
Need a rebase |
This automates the generation of package_test.go for any component that uses mdatagen. Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2d0a6db
to
ac03a83
Compare
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
This automates the generation of package_test.go for any component that uses mdatagen.
The following configuration can be used to skip or ignore certain funcs: