opentelemetry-collector
opentelemetry-collector copied to clipboard
[mdatagen] fix generated comp test for extensions and unused imports in templates
Description
When upgrading beyond v0.101.0 of mdatagen I ran into issues upgrading when running golanglint-ci because of unused imports. Namely, in component_tests the component was removed from this commit which was not caught by tests (it appears we only test receiver components & not others). The logic that generates tests for extensions, where I caught this error, ends up with a generated_component_test that does not use component in the package at all. I would've thought the contrib repo would've detected this issue since they also use mdatagen and there are extensions there + golangci-lint. I haven't dug into the why it wasn't caught there yet.
This is just a quick fix for extensions. I suspect this issue may pop up in other components as time goes on. Long term is more tests for other components.
Testing
I ran this locally against my own repo where the issue originally showed & ensured the value would be templated out appropriately.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 92.41%. Comparing base (
fead8fc) to head (5b29e5a).
Additional details and impacted files
@@ Coverage Diff @@
## main #10477 +/- ##
=======================================
Coverage 92.41% 92.41%
=======================================
Files 393 393
Lines 18605 18605
=======================================
Hits 17194 17194
Misses 1056 1056
Partials 355 355
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.